67,515
社区成员
发帖
与我相关
我的任务
分享
<bean id="htjobDetailBean" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="balanceWindUp"/>
<property name="targetMethod" value="windUp"/>
<property name="concurrent" value="false"/>
</bean>
<bean id="htcronTriggerBean" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="htjobDetailBean"/>
<property name="cronExpression">
<value>*/19 * * * * ?</value> <!--*/59 * * * * ? 0 0 1 * * ? 每天凌晨1点实行一次 -->
</property>
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="htcronTriggerBean"/>
</list>
</property>
</bean>
配置如上,这是 单独的一个 timertask-bean.xml
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/beans.xml,/WEB-INF/classes/timertask-beans.xml</param-value>
</context-param>
web.xml的 配置