通过ApplicationContext事件模式:
实现接口implements ApplicationListener<ContextRefreshedEvent> 并把类注册为bean
通过在方法上加注解
@PostConstruct
本文介绍如何使用Spring框架的事件监听机制。主要通过实现ApplicationListener接口并注册为Bean来完成。利用@PostConstruct注解简化事件处理方法的定义。
实现接口implements ApplicationListener<ContextRefreshedEvent> 并把类注册为bean
@PostConstruct
转载于:https://my.oschina.net/starryard/blog/907750
573

被折叠的 条评论
为什么被折叠?