复制代码
1
2
复制代码
1
2
复制代码
1
2
3
4
5
6
7
8
9@Component @Order(value=1) public class MyCommandLineRunner implements CommandLineRunner { @Override public void run(String... args) throws Exception { System.out.println("初始化完毕......" + new Date()); } }
复制代码
1
复制代码
1
复制代码
1启动时,还可以调用其他类进行初始化一些动作
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45复制代码@Component @Order(value=1) public class MyCommandLineRunner implements CommandLineRunner { @Autowired StatService statService; @Autowired RepairService repairService; @Autowired OilTimesService oilTimesService; @Override public void run(String... args) throws Exception { System.out.println("========系统启动...开始执行============="); statService.dis(); statService.stat(); repairService.repairDis(null, null, null, null); oilTimesService.timesfilter(null); } }
最后
以上就是酷酷黄豆最近收集整理的关于spring boot 系统启动运行的类 MyCommandLineRunner的全部内容,更多相关spring内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复