通过ApplicationContext事件模式:
实现接口implements ApplicationListener<ContextRefreshedEvent> 并把类注册为bean
通过在方法上加注解
@PostConstruct
实现接口implements ApplicationListener<ContextRefreshedEvent> 并把类注册为bean
@PostConstruct
转载于:https://my.oschina.net/starryard/blog/907750