初始化方法的调用顺序:
1.@PostConstruct修饰的方法
2.InitializingBean接口的afterPropertiesSet()方法
3.在xml中配置的init()方法
Destroy方法的调用顺序:
1.@PreDestroy修饰的方法
2.DisposableBean接口的destroy()方法
3.在xml中定义的destroy()方法
1.@PostConstruct修饰的方法
2.InitializingBean接口的afterPropertiesSet()方法
3.在xml中配置的init()方法
Destroy方法的调用顺序:
1.@PreDestroy修饰的方法
2.DisposableBean接口的destroy()方法
3.在xml中定义的destroy()方法
本文详细介绍了Java Bean在Spring框架中初始化和销毁方法的调用顺序,包括使用@PostConstruct和@PreDestroy注解的方法、实现InitializingBean和DisposableBean接口的方法以及在XML中配置的init-method和destroy-method。
305

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



