Error getting config from consul if two profiles specified with different values of some properties
メンテナーはふだん 1 日以内に返信
@spencergibb がすでに取り組んでいます。
2023年6月30日 から。
評価
この issue はまだ評価されていません。
説明
I've updated spring cloud from 2021.0.4 to 2021.0.5.
After updating I get an error while starting my spring-boot application.
I noticed, that problem is because I have test profile with disabled cloud services.
If I comment all properties which has **.discovery.** in name - it works
Of course it doesn't work in 'test' profile, because by default, discovery is enabled.
As I understand, such behaviour happens because of https://github.com/spring-cloud/spring-cloud-consul/issues/785
Is that bug? Or I have mistakes in my configuration?
my application.yml
server:
port: 8100
spring:
application:
name: rabbitmq-client
config:
import: "configserver:,consul:"
cloud:
stream:
bindings:
test:
destination: data_broker
group: client1_group
process-in-0:
destination: data_broker
group: client_group
consul:
config:
enabled: true
format: YAML
prefixes: config
default-context: rabbitmq-client
data-key: data
profile-separator: '::'
name: rabbitmq-client
discovery:
instance-id: ${spring.application.name}
prefer-ip-address: true
metadata:
version: 1.0
host: ${CLOUD_SERVICES_ADDR}
port: 8500
config:
enabled: true
discovery:
enabled: true
service-id: config-service
rabbitmq:
host: ${CLOUD_SERVICES_ADDR}
port: 5672
username: ${RABBITMQ_USER:}
password: ${RABBITMQ_PASSWORD:}
---
spring:
config:
activate:
on-profile: test
cloud:
consul:
discovery:
enabled: false
enabled: false
config:
enabled: false
discovery:
enabled: false
config:
enabled: false
discovery:
enabled: false
Stacktrace:
02:21:30.899 [restartedMain] DEBUG org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter - Application failed to start due to an exception
org.springframework.boot.context.config.ConfigDataResourceNotFoundException: Config data resource '[ConsulConfigDataResource@651d884b context = 'config/rabbitmq-client::default/', optional = true, properties = [ConsulConfigProperties@27342471 enabled = true, prefixes = list['config'], defaultContext = 'rabbitmq-client', profileSeparator = '::', format = YAML, dataKey = 'data', aclToken = [null], watch = [ConsulConfigProperties.Watch@59f16715 waitTime = 55, enabled = true, delay = 1000], failFast = true, name = 'rabbitmq-client'], profile = 'default']' via location 'consul:' cannot be found
at org.springframework.boot.context.config.ConfigDataResourceNotFoundException.withLocation(ConfigDataResourceNotFoundException.java:97)
at org.springframework.boot.context.config.ConfigDataImporter.handle(ConfigDataImporter.java:145)
at org.springframework.boot.context.config.ConfigDataImporter.load(ConfigDataImporter.java:136)
at org.springframework.boot.context.config.ConfigDataImporter.resolveAndLoad(ConfigDataImporter.java:86)
at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.withProcessedImports(ConfigDataEnvironmentContributors.java:116)
at org.springframework.boot.context.config.ConfigDataEnvironment.processWithProfiles(ConfigDataEnvironment.java:311)
at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:232)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:102)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:94)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:102)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:87)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:85)
at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:66)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:120)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:114)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:65)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:343)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:301)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292)
at ua.com.timur.rabbitmqclient.RabbitmqClientApplication.main(RabbitmqClientApplication.java:12)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.cloud.config.discovery.enabled' to java.lang.Boolean
at org.springframework.boot.context.properties.bind.Binder.handleBindError(Binder.java:387)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:347)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:332)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:262)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:223)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:210)
at org.springframework.cloud.consul.discovery.configclient.ConsulConfigServerBootstrapper.isDiscoveryEnabled(ConsulConfigServerBootstrapper.java:102)
at org.springframework.cloud.consul.discovery.configclient.ConsulConfigServerBootstrapper.lambda$initialize$1(ConsulConfigServerBootstrapper.java:58)
at org.springframework.boot.DefaultBootstrapContext.getInstance(DefaultBootstrapContext.java:119)
at org.springframework.boot.DefaultBootstrapContext.getOrElseThrow(DefaultBootstrapContext.java:111)
at org.springframework.boot.DefaultBootstrapContext.get(DefaultBootstrapContext.java:88)
at org.springframework.cloud.consul.config.ConsulConfigDataLoader.getBean(ConsulConfigDataLoader.java:103)
at org.springframework.cloud.consul.config.ConsulConfigDataLoader.doLoad(ConsulConfigDataLoader.java:62)
at org.springframework.cloud.consul.config.ConsulRetryBootstrapper.lambda$null$2(ConsulRetryBootstrapper.java:61)
at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:329)
at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:209)
at org.springframework.cloud.consul.config.ConsulRetryBootstrapper.lambda$null$3(ConsulRetryBootstrapper.java:60)
at org.springframework.cloud.consul.config.ConsulConfigDataLoader.load(ConsulConfigDataLoader.java:54)
at org.springframework.cloud.consul.config.ConsulConfigDataLoader.load(ConsulConfigDataLoader.java:38)
at org.springframework.boot.context.config.ConfigDataLoaders.load(ConfigDataLoaders.java:107)
at org.springframework.boot.context.config.ConfigDataImporter.load(ConfigDataImporter.java:128)
... 28 common frames omitted
Caused by: org.springframework.boot.context.config.InactiveConfigDataAccessException: Inactive property source 'Config resource 'class path resource [application.yml]' via location 'optional:classpath:/' (document #1)' imported from location 'class path resource [application.yml]' cannot contain property 'spring.cloud.config.discovery.enabled' [origin: class path resource [application.yml] - 72:18]
at org.springframework.boot.context.config.InactiveConfigDataAccessException.throwIfPropertyFound(InactiveConfigDataAccessException.java:126)
at org.springframework.boot.context.config.ConfigDataEnvironmentContributors$InactiveSourceChecker.onSuccess(ConfigDataEnvironmentContributors.java:310)
at org.springframework.boot.context.properties.bind.Binder.handleBindResult(Binder.java:354)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:344)
... 47 common frames omitted
02:21:30.899 [restartedMain] ERROR org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter -
***************************
APPLICATION FAILED TO START
***************************
Description:
Config data resource '[ConsulConfigDataResource@651d884b context = 'config/rabbitmq-client::default/', optional = true, properties = [ConsulConfigProperties@27342471 enabled = true, prefixes = list['config'], defaultContext = 'rabbitmq-client', profileSeparator = '::', format = YAML, dataKey = 'data', aclToken = [null], watch = [ConsulConfigProperties.Watch@59f16715 waitTime = 55, enabled = true, delay = 1000], failFast = true, name = 'rabbitmq-client'], profile = 'default']' via location 'consul:' does not exist
Action:
Check that the value 'consul:' at class path resource [application.yml] - 10:13 is correct, or prefix it with 'optional:'
- 主要言語
- Java
- スター
- 821
- フォーク
- 539
- 平均マージ
- 5時間 34分
- マージ済み PR(30日)
- 13
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
spring-cloud/spring-cloud-consul のほかの issue
-
waiting-for-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
spring-cloud/spring-cloud-consul#984 ·
メンテナーはふだん 1 日以内に返信
-
spring.cloud.consul.config.prefixes documentation update再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンdocumentation
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
spring-cloud/spring-cloud-consul#746 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
-
waiting-for-triage
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
spring-cloud/spring-cloud-consul#996 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
waiting-for-triage
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
spring-cloud/spring-cloud-consul#954 · コメント 1 件 · リアクション 5 件 ·
メンテナーはふだん 1 日以内に返信
-
waiting-for-triage
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
spring-cloud/spring-cloud-consul#951 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
spring-cloud/spring-cloud-consul の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 61/100
Vakore/ZappierGames#162 ·
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
[Bug] Lock owned by another client (e.g. Text app) cannot be unlocked from the app対応中かも @falkloewert が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug grammar sev-0
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100