org.springframework.beans.factory.InitializingBean interface exactly specifies following one method:

Java Code:
     void afterPropertiesSet() throws Exception;
But this is not a good approach as code will be coupled with Spring. So Spring have an feature .In XML-based configuration metadata, this can be done using the 'init-method' attribute.

Java Code:
<bean id="sampleInitBean" class="sample.SampleBean" init-method="init"/>

public class SampleBean {
public void init() {
// initialization code
}
}
This code is same as

Java Code:
<bean id="sampleInitBean" class="sample.AnotherSampleBean"/>
public class SampleExampleBean implements InitializingBean {
public void afterPropertiesSet() {
//  initialization coding
}
}