spring-boot - spring.profiles.include 不能与 spring 云配置服务器一起使用?
问题描述
我正在使用 spring 云配置服务器从 Github 检索配置文件。
我有 bootstrap.properties 文件,其中包含:
spring.profiles.active=dev
spring.profiles.include=a,b
在配置服务器即(github)中,我有以下文件名:
service-name-dev.properties
service-name-a.properties
service-name-b.properties
我可以看到它能够检索 service-name-dev.properties 但由于某些原因无法获取其他两个
编辑:日志
2020-10-07 12:53:51,782 [main ] ERROR [ / ] o.s.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:148) ~[spring-cloud-config-client-2.2.3.RELEASE.jar!/:2.2.3.RELEASE]
at org.springframework.cloud.bootstrap.config.PropertySourceLocator.locateCollection(PropertySourceLocator.java:52) ~[spring-cloud-context-2.2.3.RELEASE.jar!/:2.2.3.RELEASE]
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locateCollection(ConfigServicePropertySourceLocator.java:163) ~[spring-cloud-config-client-2.2.3.RELEASE.jar!/:2.2.3.RELEASE]
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator$$FastClassBySpringCGLIB$$fa44b2a.invoke(<generated>) ~[spring-cloud-config-client-2.2.3.RELEASE.jar!/:2.2.3.RELEASE]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771) ~[spring-aop-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
at org.springframework.retry.interceptor.RetryOperationsInterceptor$1.doWithRetry(RetryOperationsInterceptor.java:91) ~[spring-retry-1.2.5.RELEASE.jar!/:na]
at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:287) ~[spring-retry-1.2.5.RELEASE.jar!/:na]
at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:164) ~[spring-retry-1.2.5.RELEASE.jar!/:na]
at org.springframework.retry.interceptor.RetryOperationsInterceptor.invoke(RetryOperationsInterceptor.java:118) ~[spring-retry-1.2.5.RELEASE.jar!/:na]
at org.springframework.retry.annotation.AnnotationAwareRetryOperationsInterceptor.invoke(AnnotationAwareRetryOperationsInterceptor.java:153) ~[spring-retry-1.2.5.RELEASE.jar!/:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691) ~[spring-aop-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator$$EnhancerBySpringCGLIB$$1f84d380.locateCollection(<generated>) ~[spring-cloud-config-client-2.2.3.RELEASE.jar!/:2.2.3.RELEASE]
at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:98) ~[spring-cloud-context-2.2.3.RELEASE.jar!/:2.2.3.RELEASE]
at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:626) ~[spring-boot-2.3.2.RELEASE.jar!/:2.3.2.RELEASE]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:370) ~[spring-boot-2.3.2.RELEASE.jar!/:2.3.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) ~[spring-boot-2.3.2.RELEASE.jar!/:2.3.2.RELEASE]
at com.esure.api.paymentplanoptions.PaymentPlanOptionsApplication.main(PaymentPlanOptionsApplication.java:23) [classes!/:1.1.3-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_212]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_212]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_212]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_212]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [app.jar:1.1.3-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:109) [app.jar:1.1.3-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) [app.jar:1.1.3-SNAPSHOT]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) [app.jar:1.1.3-SNAPSHOT]
Caused by: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Internal Server Error: [{"timestamp":"2020-10-07T12:53:51.771+0000","status":500,"error":"Internal Server Error","message":"Could not construct context for config=service-name profile=a,b,dev label= includeOrigin=true; nested exception is java.lang.NullPointerException","path":"/path-to-config/service-name/a,b,dev"}]
at org.springframework.web.client.HttpServerErrorException.create(HttpServerErrorException.java:100) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:186) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:125) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:782) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:740) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:674) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:583) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment(ConfigServicePropertySourceLocator.java:264) ~[spring-cloud-config-client-2.2.3.RELEASE.jar!/:2.2.3.RELEASE]
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:107) ~[spring-cloud-config-client-2.2.3.RELEASE.jar!/:2.2.3.RELEASE]
... 29 common frames omitted
解决方案
看起来它根本不起作用。我已经在 Hoxton.SR9 上进行了测试。请参阅以下错误报告。 https://github.com/spring-cloud/spring-cloud-config/issues/847
推荐阅读
- svn - 在结帐前获取 SVN 分支的大小
- sql - 如何将指数值转换为给定的浮点数据类型值
- java - lambda中的控制反转
- mysql - 如何在mysql中的情况下进行连接
- javascript - jquery draggable 游标位置和可拖动位置不一样
- c# - 多种日期格式转换
- github - github上的目录和我的电脑不同。如何将计算机上的目录精确复制到 github?
- amazon-web-services - 我的控制台默认 vpc 网络与我的 cli 默认 vpc 网络不同
- apache-spark - SPARK 2.4 Standalone + 单个多核服务器上的多个 Worker;提交正在等待资源
- arrays - typescript array.map 丢失返回类型