SpringBoot引入监听器
方法一:
实现CommandLineRunner 接口
@Component
@Order(1)
public class AppReadyListener implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
}
}
方法二:
实现ApplicationRunner 接口
@Component
@Order(2)
public class FinishListener implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) throws Exception {
}
}