在eclipse中运行,SpringApplication.run之后的代码是可以执行的,但是放在tomcat中运行不行。

实现 ApplicationListener<ContextRefreshedEvent> 来实现。

@Component
public class StartSysListener implements ApplicationListener<ContextRefreshedEvent> {



}

相关文章: