基于配置文件的Quartz
springmvc.xml中添加配置:
<beans
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd">
<task:scheduled-tasks>
<task:scheduled ref="jobTest" method="execute" cron="*/5 * * * * ?" />
</task:scheduled-tasks>
<bean id="jobTest" class="com.mandi.springmvc.task.taskJob" />
</beans>
工作业务:
package com.mandi.springmvc.task;
import org.springframework.stereotype.Component;
@Component
public class taskJob {
public void execute() {
System.out.println("任务执行中......");
}
}