jump to navigation

Reloadable properties in Spring July 31, 2007

Posted by Phill in Spring.
Tags: , ,
comments closed

One of the issues I faced last week was to do with properties, specifically property reloading: in Spring, if you use something like PropertyPlaceholderConfigurer, the properties get set when the ApplicationContext loads up but then nothing happens when the properties change (even if you use the reloadable resource bundle).

This is only really a problem if you want to (for example) change a timeout value in the properties file. You can change it all you want, but if that value was dependency-injected via the PropertyPlaceholderConfigurer than you’re out of luck!

I was going to try and come up with a solution for this, but fortunately it seems that someone already has. I haven’t tested it yet, but it looks like it will do the job rather nicely.