2

I have this Spring MVC application that makes use of PropertyPlaceholderConfigurer to load properties using @Value annotation. I understand that all properties are loaded at server startup when context is initialized. Howevver, is there a way that I can access updated properties without having to restart TOMCAT? (perhaps making use of Apache Commons PropertiesConfiguration)?

Is there a way I can configure Apache Commons PropertiesConfiguration to work with Spring PropertyPlaceholderconfigurer?

Amit
  • 30,756
  • 6
  • 57
  • 88
va1b4av
  • 431
  • 9
  • 26
  • You can try to use ReloadableResourceBundleMessageSource, details are in this link http://stackoverflow.com/questions/9035588/dynamically-load-files-on-classpath-using-reloadableresourcebundlemessagesource – ajup Apr 18 '17 at 14:55

1 Answers1

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;
  ....
}
SAMUEL
  • 8,098
  • 3
  • 42
  • 42