2017-04-13 3 views
2

PropertyPlaceholderConfigurer를 사용하여 @Value 주석을 사용하여 속성을로드하는이 Spring MVC 애플리케이션이있다. 컨텍스트가 초기화 될 때 서버 시작시 모든 속성이로드된다는 것을 알고 있습니다. 어떻게 TOMCAT을 다시 시작하지 않고도 업데이트 된 속성에 액세스 할 수있는 방법이 있습니까? (아마도 아파치 코 몬즈 PropertiesConfiguration을 사용하고 있는가?)TOMCAT을 재시작하지 않고 Spring 리로드 속성

Spring PropertyPlaceholderconfigurer와 함께 작동하도록 Apache Commons PropertiesConfiguration을 구성 할 수있는 방법이 있습니까?

+0

당신은 ReloadableResourceBundleMessageSource를 사용하려고 할 수는 자세한 내용이 링크에 http://stackoverflow.com/questions/9035588/dynamically-load-files-on-classpath-using-reloadableresourcebundlemessagesource – ajup

답변

0
Add @RefreshScope annotation above the class which consumes the properties 
(ie has @Value annotation). Example goes as follows: 

    @RefreshScope 
    class PropertiesConsumer { 
    .... 
    @Value(..) 
    private consumerFoo; 
    .... 
    }