import org.springframework.beans.factory.InitializingBean;
@Component
public class TestInitializingBean implements InitializingBean{
@Override
public void afterPropertiesSet() throws Exception {
System.out.println("ceshi InitializingBean");
}
public void testInit(){
System.out.println("ceshi init-method");
}
}
此接口可用來注入配置文件中的信息,或者從數據庫獲取到後注入
來源: