[英]Spring reload properties without restarting TOMCAT
我有這個Spring MVC應用程序,它使用PropertyPlaceholderConfigurer來使用@Value注釋加載屬性。 我了解初始化上下文時會在服務器啟動時加載所有屬性。 但是,有沒有一種方法可以訪問更新的屬性而不必重新啟動TOMCAT? (也許利用Apache Commons PropertiesConfiguration)?
有沒有一種方法可以配置Apache Commons PropertiesConfiguration與Spring PropertyPlaceholderconfigurer一起使用?
在使用屬性的類上方添加@RefreshScope
注釋(即具有@Value注釋)。 示例如下:
@RefreshScope
class PropertiesConsumer {
....
@Value(..)
private consumerFoo;
....
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.