We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@configuration @ConditionalOnProperty(prefix = "yzw.fss",name = "address") public class FastDFSAutoConfiguration {
protected final Logger logger = LoggerFactory.getLogger(this.getClass()); @Bean(name = "fastDFSClientWrapper") public FastDFSClient getFastDFSClientWrapper() { FastDFSClient fastDFSClientWrapper = new FastDFSClient(); logger.info("getFastDFSClientWrapper :{}", fastDFSClientWrapper); return fastDFSClientWrapper; }
} 如果在本地properties文件配置了就能进行getFastDFSClientWrapper方法创建Bean,如果移到Nacos配置就不行,nacos配置是正常读取的,数据库其他中间件配置都能读取到,目前Nacos是不是不支持ConditionalOnProperty注解? yzw.fss.address=https://fss-ext-qa.yzw.cn #在文件存储服务中申请的应用标识。 yzw.fss.app.name=hello #应用对应的密钥。 yzw.fss.app.secret=scTbUDPoAvGHtLlv69
The text was updated successfully, but these errors were encountered:
应该是加载顺序的问题吧?Nacos有不支持ConditionalOnProperty注解这一说吗,如果真的有请艾特我一下。
Sorry, something went wrong.
这应该不是Nacos的问题,应该是nacos-spring-boot的问题,应该是ConditionalOnProperty的生效时间在拉取配置之前。 相关issue: nacos-group/nacos-spring-boot-project#300
nacos是负责推送和管理远程配置的, 应用什么时候触发订阅和获取配置是由应用控制的, ConditionalOnProperty是应用测注解,需要应用测保证先从nacos获取配置并应用后再生效,并且需要在配置变更后进行重新加载等操作。
No branches or pull requests
@configuration
@ConditionalOnProperty(prefix = "yzw.fss",name = "address")
public class FastDFSAutoConfiguration {
}
如果在本地properties文件配置了就能进行getFastDFSClientWrapper方法创建Bean,如果移到Nacos配置就不行,nacos配置是正常读取的,数据库其他中间件配置都能读取到,目前Nacos是不是不支持ConditionalOnProperty注解?
yzw.fss.address=https://fss-ext-qa.yzw.cn
#在文件存储服务中申请的应用标识。
yzw.fss.app.name=hello
#应用对应的密钥。
yzw.fss.app.secret=scTbUDPoAvGHtLlv69
The text was updated successfully, but these errors were encountered: