<p>I'm trying to add 2 different discovery clients depending on my Env variable. I want to do that for easier local development, without running local k8s cluster.</p>
<pre><code>  cloud:
    retry:
      initial-interval: 10
      max-interval: 20
    kubernetes:
      discovery:
        enabled: ${!CONSUL_ENABLED:true}
    consul:
      host: ${CONSUL_HOST:localhost}
      port: ${CONSUL_PORT:8500}
      discovery:
        enabled: ${CONSUL_ENABLED:false}
        fail-fast: true
        instance-id: ${spring.application.name}-${server.port}-${instance-id}
        health-check-path: /actuator/health
        health-check-interval: 20s
</code></pre>
<p>My gradle file:</p>
<pre><code>implementation 'org.springframework.cloud:spring-cloud-starter-kubernetes'
implementation 'org.springframework.cloud:spring-cloud-starter-consul-discovery'
</code></pre>
<p>But this config fails with error:</p>
<pre><code>Field registration in org.springframework.cloud.netflix.zuul.ZuulProxyAutoConfiguration required a single bean, but 2 were found:
    - getRegistration: defined by method 'getRegistration' in class path resource [org/springframework/cloud/kubernetes/discovery/KubernetesDiscoveryClientAutoConfiguration.class]
    - consulRegistration: defined by method 'consulRegistration' in class path resource [org/springframework/cloud/consul/serviceregistry/ConsulAutoServiceRegistrationAutoConfiguration.class]
</code></pre>
<p>Is there any way to do that?</p>

Pixel
<p>Ok, i found way to do that, you must disable all k8s, not only discovery:</p>
<pre><code>  cloud:
    retry:
      initial-interval: 10
      max-interval: 20
    kubernetes:
      discovery:
        enabled: ${K8S_ENABLED:true}
      enabled: ${K8S_ENABLED:true}
    consul:
      host: ${CONSUL_HOST:localhost}
      port: ${CONSUL_PORT:8500}
      discovery:
        enabled: ${CONSUL_ENABLED:false}
        fail-fast: true
        instance-id: ${spring.application.name}-${server.port}-${instance-id}
        health-check-path: /actuator/health
        health-check-interval: 20s
</code></pre>
<p>But is there a way to combine  K8S_ENABLED and CONSUL_ENABLED variable to one?</p>
