SpringBoot启动后执行指定任务(CommandLineRunner)

使用方法

实现CommandLineRunner接口,实现run方法

@SpringBootApplication
public class Application implements CommandLineRunner {


    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        System.out.println("项目启动完毕");
    }
}



posted @ 2020-12-16 20:21  Eli-Hou  阅读(319)  评论(0)    收藏  举报