0

I’m using Spring 3.2.11.RELEASE. I currently have the following set up in my application context file for the purposes of loading a cron trigger based off a schedule defined in a properties file (the property = cron.schedule) …

<bean id="localPropertyConfigurer"
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location">
        <value>classpath:application.properties</value>
    </property>
</bean>
…
<bean id="updateResourcesJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">  
    <property name="targetObject" ref="myService" />  
    <property name="targetMethod" value="myMethod" />  
    <property name="concurrent" value="true" />  
</bean>

<bean id="updateResourcesCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail" ref="myJob" />
    <property name="cronExpression" value="${cron.schedule}" />
</bean>

My question is, I would like to create an XML configuration in my context file that allows me to edit my properties file and have everything automatically reloaded without having to restart my server or re-deploy my application. I have read several places about Apache Commons Configuration, but I can’t figure out how to take the above and rewrite an XML config that would utilize the configuration.

Thanks for any help, - Dave

Dave
  • 15,639
  • 133
  • 442
  • 830
  • Maybe you can achieve this by using custom scopes for your beans. Take a look at this very good explanation: http://stackoverflow.com/a/10282328/561147 – bruno.zambiazi Mar 30 '16 at 01:22
  • Does this idea require me to create a Java class that implements Scope? – Dave Mar 31 '16 at 20:03

0 Answers0