Closed hendisantika closed 1 year ago
You should either remove bootstrap or remove spring.config.import
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.
You mean remove this properties spring.config.import="consul:localhost:8500;catalog"
or remove org.springframework.cloud:spring-cloud-starter-bootstrap
lib?
If that is. I already commented it but the error still exist.
You get the same error by doing both things?
Another error actually:
Now I've got:
com.ecwid.consul.transport.TransportException: java.net.UnknownHostException: consul: nodename nor servname provided, or not known
But, My Consul Server already run
Hi just to let you know if somebody still facing this issue, I tried a few combinations and the only one that worked was excluding ConsulConfigAutoConfiguration
, the final yml looks like this.
---
spring:
config:
activate:
on-profile: consul
import: consul:${consul_url:localhost:8500}
cloud:
consul:
config:
fail-fast: ${FAIL_FAST:true}
format: yaml #Only in the case if you have yml config to bind
autoconfigure:
exclude: org.springframework.cloud.consul.config.ConsulConfigAutoConfiguration
I have encountered the same mistake.
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 1 of method configWatch in org.springframework.cloud.consul.config.ConsulConfigAutoConfiguration$ConsulRefreshConfiguration required a single bean, but 2 were found:
- consulPropertySourceLocator: defined by method 'consulPropertySourceLocator' in class path resource [org/springframework/cloud/consul/config/ConsulConfigBootstrapConfiguration$ConsulPropertySourceConfiguration.class]
- configDataConsulConfigIndexes: a programmatically registered singleton
Action:
Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed
Where are the configDataConsulConfigIndexes
come from? I think it from spring-cloud-starter-bootstrap
, is not it?
The reason for this problem should be referenced to spring-cloud-starter-bootstrap
, but it defines spring.config.import
in non-bootstrap.yml. We should remove spring-cloud-starter-bootstrap
dependency or remove spring.config.import
in application-xx.yml
.
spring.config.import should not go in bootstrap.yml
why?
@zhnkc9 because bootstrap automatically imports configuration without the need for spring.config.import
Hi All, I am using Spring Cloud 2020.0.2 with Consul.
I am having error during startup as follow:
You can try my repo to run on your local --> https://gitlab.com/microservice-samples/docker-spring-cloud
Any idea?
Thanks