springboot启动时执行任务CommandLineRunner
springboot启动时执行任务CommandLineRunner
# SpringBoot中CommandLineRunner的作用
> 平常开发中有可能需要实现在项目启动后执行的功能,SpringBoot提供的一种简单的实现方案就是添加一个model并实现CommandLineRunner接口,实现功能的代码放在实现的run方法中
# 简单例子
启动类
@SpringBootApplication
public class CoreTestApplication {
publi
原创
2020-11-18 16:28:33 ·
133 阅读 ·
0 评论