Spring注解定时任务

Posted 逝年的我们

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Spring注解定时任务相关的知识,希望对你有一定的参考价值。

xmlns:task="http://www.springframework.org/schema/task"

xsi:schemaLocation="
            http://www.springframework.org/schema/task
            http://www.springframework.org/schema/task/spring-task-3.0.xsd


 <task:scheduler id="myScheduler" pool-size="5"/>  
    <task:annotation-driven scheduler="myScheduler"/> 



@Scheduled(cron = "0/5 * * * * ?")
    public void login()throws Exception{
        System.out.println("王华");
    }
        

 

以上是关于Spring注解定时任务的主要内容,如果未能解决你的问题,请参考以下文章

Spring注解定时任务,线程池问题

Spring注解定时任务,线程池问题

Spring boot实现定时任务二:使用注解@scheduled和@EnableScheduling

spring定时任务Spring Scheduler

「spring」定时任务(纯注解方式)

使用spring提供的@Scheduled注解创建定时任务