Hi,
if you want to call a method which you want to be run after all the injections are done just do the following:
1. Make your class implement org.springframework.beans.factory.InitializingBean
2. override afterPropertiesSet method
and that is it. Sample code will be like:
public class MyBean implements InitializingBean {
@Autowired
private MyDao dao;
@Autowired
private MyOtherDao otherDao;
@Override
public void afterPropertiesSet() throws Exception {
System.out.println("this will be called after all the setters are done.");
}
}
Advertisements