我是靠谱客的博主 酷酷黄豆,这篇文章主要介绍spring boot 系统启动运行的类 MyCommandLineRunner,现在分享给大家,希望可以做个参考。



@Component
@Order(value=1)
public class MyCommandLineRunner implements CommandLineRunner {
@Override

public void run(String... args) throws Exception {
System.out.println("初始化完毕......" + new Date());
}
}


启动时,还可以调用其他类进行初始化一些动作
@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内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(119)

评论列表共有 0 条评论

立即
投稿
返回
顶部