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

@PostConstruct and @PreDestroy Annotations

These annotations are introduced in Spring 2.5 to call the bean life cycle methods just like init and destroy methods. @PostConstruct : is called after the bean has been initialized and before this bean is returned to the requested object. @PreDestroy : is called just before the bean is removed from the container Create a […]

Share this article on
< Previous Next >