ApplicationRunner CommandLineRun
2018-10-20 本文已影响0人
风雨楼兰
当需要在Spring Boot启动后搞点事情的时候,实现ApplicationRunner 或CommandLineRunner
@Component
public class MyBean implements CommandLineRunner {
public void run(String... args) {
// Do something...
}
}
ApplicationRunner提供ApplicationArguments作为参数,CommandLineRunner提供String[]