Spring bean life cycle methods – BeanPostProcessor

BeanPostProcessor is used to perform some operations before and after creating a bean,this allows us to add some code before and after creating the bean. BeanPostProcessor is applicable for all the beans, which means its methods will be executed for each bean we define in the xml. We can use the BeanPostProcessor to execute some […]

Share this article on

InitializingBean and DisposableBean, Custom init-method and custom destroy-method

InitializingBean interface has one method afterPropertiesSet() which is called after all the properties of a bean are set. DisposableBean interface has one method destroy() which is called before the bean gets destroyed or before it gets removed from the application context. Let us write a UserService class which implements above interfaces package com.kb.beans;   import […]

Share this article on
< Previous Next >