Top Description Methods
org.springframework.beans.factory

public Interface InitializingBean

Known Direct Implementers
org.springframework.beans.factory.config.AbstractFactoryBean, org.springframework.beans.factory.config.FieldRetrievingFactoryBean, org.springframework.beans.factory.config.MethodInvokingBean, org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer, org.springframework.beans.factory.config.PropertiesFactoryBean, org.springframework.beans.factory.config.ServiceLocatorFactoryBean, org.springframework.beans.factory.config.YamlMapFactoryBean, org.springframework.beans.factory.config.YamlPropertiesFactoryBean, org.springframework.beans.factory.wiring.BeanConfigurerSupport

Interface to be implemented by beans that need to react once all their properties have been set by a BeanFactory: e.g. to perform custom initialization, or merely to check that all mandatory properties have been set.

An alternative to implementing InitializingBean is specifying a custom init method, for example in an XML bean definition. For a list of all bean lifecycle methods, see the BeanFactory javadocs.

Authors
Rod Johnson, Juergen Hoeller
See Also
DisposableBean, org.springframework.beans.factory.config.BeanDefinition#getPropertyValues(), org.springframework.beans.factory.support.AbstractBeanDefinition#getInitMethodName()

Method Summary

Modifier and TypeMethod and Description
public void
afterPropertiesSet()

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

Method Detail

afterPropertiesSetback to summary
public void afterPropertiesSet() throws Exception

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

Exceptions
Exception:
in the event of misconfiguration (such as failure to set an essential property) or if initialization fails for any other reason