基于配置文件的Quartz

2017-12-07  本文已影响5人  游园拾忆

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("任务执行中......");
    }
}
上一篇 下一篇

猜你喜欢

热点阅读