Error getting config from consul if two profiles specified with different values of some properties
Maintainer thường phản hồi trong vòng 1 ngày
@spencergibb đang làm issue này rồi.
Từ ngày 30/6/2023.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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:'
- Ngôn ngữ chính
- Java
- Star
- 821
- Fork
- 539
- Merge trung bình
- 5 giờ 34 phút
- Pull request đã merge (30 ngày)
- 13
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của spring-cloud/spring-cloud-consul
-
Consul 5.0.1 drops stale and consistent flags from health and catalog HTTP requestsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
spring-cloud/spring-cloud-consul#1029 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
waiting-for-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
spring-cloud/spring-cloud-consul#984 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
spring.cloud.consul.config.prefixes documentation updateCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởdocumentation
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
spring-cloud/spring-cloud-consul#746 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
waiting-for-triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
spring-cloud/spring-cloud-consul#996 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Migrating from Spring boot 3.5.11 to 4.0.3 : reregister-service-on-failure not working anymoreĐang mởwaiting-for-triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
spring-cloud/spring-cloud-consul#954 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của spring-cloud/spring-cloud-consul
Issue tương tự
-
[GLOBAL] Advancement resetĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Vakore/ZappierGames#184 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
lugassawan/swe-workbench#823 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
cassiancc/Raspberry-Core#69 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
IronCoreLabs/ironcore-alloy#351 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
checkstyle/checkstyle#22145 ·
Maintainer thường phản hồi trong vòng 1 ngày