java - how can I reload/refresh properties in spring at runtime without jvm restart? -
how can reload/refresh properties in spring @ runtime without jvm restart?
i looking elegant , should applicable in prod. therefore, jrebel off table guess.
currently, have properties in myproject.properties
oms.url=abbc.com checkin.enabled=true
and java file autowired search , use these properties applicationcontext provided different property files:
<bean id="applicationproperties" class="myproject.config.custompropertyplaceholder"> <property name="ignoreresourcenotfound" value="true" /> <property name="locations"> <list> <value>classpath:myproject.properties</value> <value>file:${catalina_base}/lib/myproject.properties</value> <!--<value>file:///appl/conf/outlet.properties</value>--> <value>classpath:db.password</value> <value>file:${catalina_base}/lib/db.password</value> <!-- <ref bean="applpropertiesfromdb" /> --> </list> </property> </bean>
and java file as:
@value("${checkin.enabled}") private string checkinenabled;
use reloadableresourcebundlemessagesource
.
but not refreshed.
private string checkinenabled;
you must reload checkinenabled
variable.
Comments
Post a Comment