-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@ConditionalOnProperty 获取不到配置 #903
Comments
有具体case吗? |
直接在classpath下放置配置是没问题的,使用配置中心不行。 @configuration }
@bean Description: The dependencies of some of the beans in the application context form a cycle: webConfig (field private com.fengunion.ecis.config.properties.EcisProperties com.fengunion.ecis.config.web.WebConfig.ecisProperties) |
@ConditionalOnProperty (ecis.swagger-open=true) did not find property 'swagger-open' |
多谢,我们后面看一下。 |
确认是由于 不过有一个work around可以试一下,可以在spring boot应用启动时通过api方式把apollo的配置注入进去,比如main函数中: String namespaceWithConditionalProperties = "someNamespace";
Config config = ConfigService.getConfig(namespaceWithConditionalProperties);
context.getEnvironment().getPropertySources().addFirst(new ConfigPropertySource(namespaceWithConditionalProperties, config)); |
感谢 @tastypinenut 提供Pull Request,目前已经支持在启动阶段注入配置,从而可以很好地支持 |
case先关闭了,如还有问题,可以提供更多信息,或进群交流。 |
1.1.1还是不行 |
照着 3.2.1.3 在Spring Boot初始bootstrap阶段注入配置 应该是没问题的 |
这个问题解决了吗,我也遇到了 ,需要有些根据条件来加载bean的需求,但是读取不到 |
使用@ConditionalOnProperty 配置bean时,获取不到配置中心的配置
The text was updated successfully, but these errors were encountered: