定时触发器的spring 配置:
**************************************************************
quartz-application.xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<!-- 线程执行器配置,用于任务注册 -->
<bean id="executor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="10" />
<property name="maxPoolSize" value="100" />
<property name="queueCapacity" value="500" />
</bean>
<!-要执行的类,方法,service -->
<bean id="tongjiJob" class="com.aa..Statistics" >
<property name="studentService" ref="studentService" />
<property name="teacherService" ref="teacherService" />
<property name="classesService" ref="classesService" />
</bean>
<!-- 调度业务 -->
<bean id="jobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="tongjiJob" />
<property name="targetMethod" value="tongji" />
</bean>
<!-- 定义调度触发器 -->
<bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="jobDetail" />
<property name="cronExpression" value="0 30 20 ? * *" /> <!-- 每天晚上8点30分执行-->
</bean>
<!-- 定义调度触发器配置
<bean id="taskTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="jobDetail" />
<property name="repeatInterval" value="1000" />
</bean>
-->
<!-- 设置调度 -->
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronTrigger" />
</list>
</property>
<property name="taskExecutor" ref="executor" />
</bean>
</beans>