Cron Timer functionality using Spring and Quartz
From Kb
Contact Article Author | Blog of Article Author | FirstPartners.net Home | LinkedIn profile of Author
Quartz
- ensure you have Quartz libs available
- add the following to your Spring configuration file
<!-- Detail of the bean that will be called --> <bean id="PointerToMethodThatWeCall" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" ref="OurSpringBean" /> <property name="targetMethod" value="methodNameToCall" /> <property name="concurrent" value="true" /> <!--wait until previous call completes --> </bean> <!-- Detail of how often we call the Overnight bean --> <bean id="HowOftenWeCallTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean"> <!-- see the example of method invoking job above --> <property name="jobDetail" ref="PointerToMethodThatWeCall" /> <!-- 20 seconds to allow for startup--> <property name="startDelay" value="2000" /> <!-- repeat every 24 hours --> <property name="repeatInterval" value="86400000" /> </bean> <!-- Overall Quartz list of time based triggers --> <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="HowOftenWeCallTrigger" /> </list> </property> </bean>
Other Spring Related Articles
Spring MVC | Maven Information | Hibernate | Sending Web Email from Spring | Spring Pointer to Log4j Configuration File | Cron Timer functionality using Spring and Quartz | Customising Spring Property File Loading

