实现 org.springframework.beans.factory.InitializingBean接口,重写afterPropertiesSet方法
public class Servlet implements InitializingBean{
@Autowired
private CustomerMailService customerMailService;
@Override
public void afterPropertiesSet() throws Exception {
// TODO Auto-generated method stub
System.out.println("----------------------------------------------->>>>>");
customerMailService.getCustomerMail();
System.out.println("-------------++++++++++++++++++++----------------->test");
}
原文:http://www.cnblogs.com/dan-yan/p/4903809.html