@Component public class Runner implements CommandLineRunner { @Override public void run(String... args) throws Exception { System.out.println("The Runner start to initialize ..."); } }
项目启动的时候加载缓存之类的可以使用此方法,主要是实现CommandLineRunner,然后重写run方法
原文:https://www.cnblogs.com/huangtao1927/p/9499120.html