Bean factory implementations should support the standard bean lifecycle interfaces as far as possible. The full set of initialization methods and their standard order is:
BeanFactory的实现应该尽可能支持标准的bean生命周期,以下是所以的方法的顺序的依次列表
1. BeanNameAware's
setBeanName
2. BeanClassLoaderAware's
setBeanClassLoader
3. BeanFactoryAware's
setBeanFactory
4. ResourceLoaderAware's
setResourceLoader
(only applicable when running in an application context)
5. ApplicationEventPublisherAware's
setApplicationEventPublisher
(only applicable when running in an application context)
6. MessageSourceAware's
setMessageSource
(only applicable when running in an application context)
7. ApplicationContextAware's
setApplicationContext
(only applicable when running in an application context)
8. ServletContextAware's
setServletContext
(only applicable when running in a web application context)
9.
postProcessBeforeInitialization
methods of BeanPostProcessors
10. InitializingBean's
afterPropertiesSet
11. a custom init-method definition
12.
postProcessAfterInitialization
methods of BeanPostProcessors
当关闭一个bean的时候
On shutdown of a bean factory, the following lifecycle methods apply:
1. DisposableBean's
destroy
2. a custom destroy-method definition
大盘预测
国富论
posted on 2007-08-28 14:09
华梦行 阅读(558)
评论(0) 编辑 收藏 所属分类:
Spring