public class WebContextListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContextEvent.getServletContext());
ISrInforService srInforService = applicationContext.getBean(ISrInforService.class);
// ISrInforService srInforService = (ISrInforService) applicationContext.getBean("srInforService");
srInforService.countAllSrInforsScore();
}
@Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {
}
}
ISrInforService srInforService = applicationContext.getBean(ISrInforService.class);
或
ISrInforService srInforService = (ISrInforService) applicationContext.getBean("srInforService");
都可以。
然后配置web.xml
:
<!-- Spring监听配置,Web容器启动自动装配ApplicationContext的配置信息-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
参考:
最新评论
网飞没问题, 迪士尼+有解决方案么?
pp助手是安卓手机用的,根本下载用不来苹果
已解决
这样的话数据库里的结构为{"attachment":{"content":"xxx"}}, 要怎么才能变成{"content":"xxx"},从而使结构保持一致?
赞! make test不过的坑都写到的,谢谢楼主~
谢谢你
用了root用户还是一直502是怎么回事呢
student id 是空的