Spring Bean Life Cycle

By implementing InitializingBean and DisposableBean interfaces
Providing init-method and destroy-method in xml configuration or @PostConstruct and @PreDestroy annotations for methods

For activating post processor annotation annotations use

or by

used to activate applied annotations in already registered beans in application context (context:component-scan does what context:annotation-config does, but additionally it scan the packages and register the beans)

ApplicationContextAware
BeanFactoryAware
BeanNameAware
ResourceLoaderAware
ServletContextAware
ServletConfigAware

Leave a comment

Your email address will not be published. Required fields are marked *