diff --git a/src/main/java/com/example/demo/DemoApplication.java b/src/main/java/com/bw/Rkday4Application.java similarity index 50% rename from src/main/java/com/example/demo/DemoApplication.java rename to src/main/java/com/bw/Rkday4Application.java index 094d95b..118c836 100644 --- a/src/main/java/com/example/demo/DemoApplication.java +++ b/src/main/java/com/bw/Rkday4Application.java @@ -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); } } diff --git a/src/main/java/com/bw/test/ScheduledPrintNameService.java b/src/main/java/com/bw/test/ScheduledPrintNameService.java new file mode 100644 index 0000000..6208f69 --- /dev/null +++ b/src/main/java/com/bw/test/ScheduledPrintNameService.java @@ -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("哈哈哈"); + } +} diff --git a/理论错题 b/理论错题 new file mode 100644 index 0000000..e69de29