2022年2月15日

SpringBoot - 启动的时候运行一些特定的代码

摘要: 可以实现接口 ApplicationRunner 或者 CommandLineRunner,这两个接口实现方式一样,它们都只提供了一个 run 方法。 @Component public class MyBean implements CommandLineRunner { @Override pu 阅读全文

posted @ 2022-02-15 10:14 每天积极向上 阅读(161) 评论(0) 推荐(0) 编辑

SpringBoot - 实现定时任务

摘要: 1.在启动类,加入@EnableScheduling 注解 @SpringBootApplication @EnableScheduling public class SpringbootScheduleApplication { public static void main(String[] a 阅读全文

posted @ 2022-02-15 09:29 每天积极向上 阅读(42) 评论(0) 推荐(0) 编辑

SpringBoot - 实现异步

摘要: 1.在启动类,加入@EnableAsync 注解 @SpringBootApplication @EnableAsync public class AsyncLearnApplication { public static void main(String[] args) { SpringAppli 阅读全文

posted @ 2022-02-15 09:19 每天积极向上 阅读(388) 评论(0) 推荐(0) 编辑

导航