需求:SpringBoot项目启动成功后执行某方法 方案:在spring-boot中提供了两种Runner接口:ApplicationRunner和CommandLineRunner,编写自己的类实现这两种接口的run方法,均可实现需求 不同的是实现的两个run方法接收的参数不同,这也是他俩唯一的不同, ApplicationRunner 接收的是 ApplicationArguments 类型的参数,即应用程序启动参数 CommandLineRunner 接收的是String类型的可变参数,它…