spring-cloud / spring-cloud-consul

Spring Cloud Consul
http://cloud.spring.io/spring-cloud-consul/
Apache License 2.0
813 stars 541 forks source link

UnsatisfiedDependencyException while creating ConfigWatch bean #757

Closed omarchenko4j closed 1 year ago

omarchenko4j commented 3 years ago

When the property spring.cloud.consul.config.watch.enabled is true an exception UnsatisfiedDependencyException is thrown in ConsulRefreshConfiguration when creating a bean ConfigWatch because 2 candidate beans with type ConsulConfigIndexes are found:

  1. consulPropertySourceLocator
  2. configDataConsulConfigIndexes

This happens because the ConsulPropertySourceLocator class implements the ConsulConfigIndexes interface as well as ConsulConfigDataIndexes, which is registered as a bean dynamically in the ConsulConfigDataLocationResolver:resolveProfileSpecific().

Reproduced in this test project on Spring-Cloud version 2020.0.4 with spring-cloud-starter-consul-config version 3.0.4.

spencergibb commented 1 year ago

why do you have spring.config.import and bootstrap? Only one is required.

spring-cloud-issues commented 1 year ago

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-cloud-issues commented 1 year ago

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.