//创建类,并实现CommandLineRunner接口
public class ApplicationStartupRunner implements CommandLineRunner {
//重写run(),在项目启动后,执行了SpringApplication.run(SpringBootWebApplication.class, args);后,会执行此方法
//通常用于项目启动时自动加载一些配置,缓存。比如存一些数据库的配置到redis
@Override
public void run(String... args) throws Exception {
logger.info("Application Started !!");
}
}
CommandLineRunner
最新推荐文章于 2023-04-03 17:50:58 发布