前瞻
Springboot启动后,需要加载一些配置文件至内存中
方法:
编写普通类,继承ApplicationListener,重写onApplicationEvent方法
@Component
@Slf4j
public class InitTaskListener implements ApplicationListener<ContextRefreshedEvent> {
@SneakyThrows
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
System.out.println("所有bean加载完之后开始执行....");
}
}