美文网首页
基于配置文件的Quartz

基于配置文件的Quartz

作者: 游园拾忆 | 来源:发表于2017-12-07 14:34 被阅读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("任务执行中......");
    }
}

相关文章

网友评论

      本文标题:基于配置文件的Quartz

      本文链接:https://www.haomeiwen.com/subject/ujbdixtx.html