spring boot 定时器(支持多任务)

还在傻傻的配detail,trigger,spring boot 注解一步解决,里面直接写逻辑代码

        <dependency>
            <groupId>org.quartz-schedulergroupId>
            <artifactId>quartzartifactId>
            <version>2.2.1version>
        dependency>
package com.hqs.shmis.config.quartz;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@EnableScheduling
public class ScheduledTest {

    @Scheduled(cron = "0/3 * * * * ?" )
    public void test(){
        System.out.println("测试任务开始");
    }
    @Scheduled(cron = "0/4 * * * * ?")
    public void test2(){
        System.out.println("测试任务2开始");
    }
}

spring boot 定时器(支持多任务)_第1张图片

你可能感兴趣的:(java)