yhs0092 commented on issue #1264: 怎样在程序里通过注解的方式获取配置参数 URL: https://github.com/apache/servicecomb-java-chassis/issues/1264#issuecomment-509049963 通过注解的方式获取配置值的话,可以用`org.springframework.beans.factory.annotation.Value`,但是这种注解只能初始化一次配置值,无法在后面进行动态配置刷新。 另外还有两种获取配置值的方式可以考虑一下: 1. 使用Archaius的API获取配置值,参考[这里](https://docs.servicecomb.io/java-chassis/zh_CN/config/general-config.html)的“在程序中读取配置信息”部分 2. 使用ServiceComb-Java-Chassis提供的配置注入对象功能,参考[这篇文档](https://docs.servicecomb.io/java-chassis/zh_CN/config/inject-config.html)。需要注意的是,通过这种功能创建的配置注入对象,如果不再使用的话,需要进行显式的注销操作(文末有说明),否则会造成内存泄漏。
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
