标签:and cat nbsp context refresh list eth 指定 stc
1.实现ApplicationRunner和CommandLineRunner接口(建议)
当springboot的main方法快要执行结束时会调用afterRefresh然后再调用callRunners来加载所有的实现ApplicationRunner和CommandLineRunner的类然后执行run方法来初始化所写的东西
2.<1>实现InitializingBean接口(不建议) <2><bean>元素中配置指定的init-method <3>@PostConstruct
3.实现ContextRefreshedEvent类型ApplicationListener接口ApplicationListener<ContextRefreshedEvent>,然后重写onApplicationEvent方法
标签:and cat nbsp context refresh list eth 指定 stc
原文地址:https://www.cnblogs.com/olzoooo/p/11699781.html