Describe the bug I have a setup where I use discovery to contact the spring config server. In my case I have both eureka and consul in the pom.xml If I disable eureka in the bootstrap properties, I expect consul to be picked. It does not, it was working using spring boot 2.1.

Tested with spring boot 2.3.10 and spring cloud Hoxton.SR11

Sample pom.xml

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-consul-discovery</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

bootstrap.properties

spring.cloud.config.enabled=true
spring.cloud.config.discovery.enabled=true
spring.cloud.config.fail-fast=true

spring.cloud.consul.enabled=true
spring.cloud.consul.discovery.enabled=true

eureka.client.enabled=false

I believe there is 2 reasons for that issue. EurekaConfigServerBootstrapConfiguration should be conditional on eureka.client.enabled. Also org.springframework.cloud.config.client.DiscoveryClientConfigServiceBootstrapConfiguration#configServerInstanceProvider first pick the function over the discoveryClient, which seems a bit arbitrary.

Comment From: spencergibb

Choosing the function first is a deliberate decision.

Comment From: roll57

Here is a simple repository to reproduce the case https://github.com/roll57/eureka-consul-demo

Comment From: spencergibb

Closed via 76b21a4a2a71df946498dfe2033bc744ed49eea5