spring类初始化后执行方法
- 实现接口InitializingBean实现afterPropertiesSet方法
- 基于注解@PostConstruct
@PostConstruct public void init(){ System.out.println("........") }
构造器、@PostConstruct、InitializingBean、BeanPostProcessor接口执行顺序
1、执行无参构造函数
2、执行被@postConstruct注解的方法
3、执行InitializingBean 的 afterPropertiesSet方法
4、执行BeanPostProcessor 的postProcessBeforelnitialization方法
5、执行BeanPostProcessor的postProcessAfterlnitialization方法
posted on 2021-06-04 17:45 1625101366 阅读(1084) 评论(0) 编辑 收藏 举报