Open tanwan opened 2 years ago
Does this happen in 2020.0.4 as well?
Yes, I tried 2020.0.4 and 2021.0.0-RC1, they all happened.
There is a similar issue in 2021.0.1, Boot 2.6.6; setting spring.cloud.config.discovery.enabled=true
by default, and spring.cloud.config.discovery.enabled=false
for a profile specific document in the same file produces an InactiveConfigDataAccessException
if the profile isn't active.
Describe the bug When I set discovery setting in specific profile(e.g. application-test.yml), it will raise an exception.
The bootstrapContext register Binder with activationContext after contributors process imports. So in
ConfigServerConfigDataLocationResolver#resolveProfileSpecific
method, the bootstrapContext has no activationContext, and the resolverContext has activationContext. Therefore, resolverContext resolvedspring.cloud.config.discovery.enabled
is true, However bootstrapContext resolved result is false. It cause the ConfigServerInstanceProvider.Function register in EurekaConfigServerBootstrapper is null.Sample The configuration in application-test.yml