67,513
社区成员
发帖
与我相关
我的任务
分享
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="ctTrigger1" />
<ref bean="ctTrigger2" />
<ref bean="stTrigger1" />
</list>
</property>
<property name="taskExecutor">
<bean class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="10" />
<property name="maxPoolSize" value="20" />
<property name="queueCapacity" value="10" />
<property name="threadNamePrefix" value="TASK_"/>
</bean>
</property>
</bean>
<bean id="ctTrigger1" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="name" value="CT_T1"/>
<property name="jobDetail" ref="ctDetail1" />
<property name="cronExpression" value="0/30 * * * * ?" />
</bean>
<bean id="ctDetail1" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="ctJob1" />
<property name="targetMethod" value="doJob" />
</bean>
<bean id="ctJob1" class="xxxJob">
</bean>
xxxJob.java
public void doJob() {
try {
//business code
} catch (Exception e) {
//error log
}
}