day04rikao
parent
a4027457b7
commit
235238306d
|
@ -1,13 +1,15 @@
|
|||
package com.example.demo;
|
||||
package com.bw;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@SpringBootApplication
|
||||
public class DemoApplication {
|
||||
@EnableScheduling
|
||||
public class Rkday4Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DemoApplication.class, args);
|
||||
SpringApplication.run(Rkday4Application.class, args);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.bw.test;
|
||||
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @ClassName Test
|
||||
* @Description 描述
|
||||
* @Author Chen
|
||||
* @Date 2024/7/22 8:43
|
||||
*/
|
||||
//创建一个任务类 ScheduledPrintNameService
|
||||
@Component
|
||||
public class ScheduledPrintNameService {
|
||||
//定时器 5秒执行一次
|
||||
@Scheduled(cron = "*/5 * * * * ?")
|
||||
public void test(){
|
||||
System.out.println("哈哈哈");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue