如何让spring mvc web应用启动时就执行特定处理
1个回答
展开全部
写一个类实现InitializingBean接口,并在application.xml注入bean就行了,
public class InitLoadData implements InitializingBean {
@Override
public void afterPropertiesSet() throws Exception {
// TODO Auto-generated method stub
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>init load info");
}
}
配置bean
<bean class="xx.xx.InitLoadData"></bean>
public class InitLoadData implements InitializingBean {
@Override
public void afterPropertiesSet() throws Exception {
// TODO Auto-generated method stub
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>init load info");
}
}
配置bean
<bean class="xx.xx.InitLoadData"></bean>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询