项目申报审批系统遇到的一些问题
1.项目所有操作异常缓慢。
问题:
Spring的Application对象在每次获取 bean的时候均加载了一次application对象。
解决办法,对象只加载一次。
使用这段代码
ServletContext sc = ServletActionContext.getServletContext();
WebApplicationContext ac = WebApplicationContextUtils
.getRequiredWebApplicationContext(sc);
DwyzService dwyzService = (DwyzService) ac.getBean("DwyzService");
替代
AbstractApplicationContext ctx=new ClassPathXmlApplicationContext(new String[]{"beans.xml"});
IHs002002Service hs002002Service=(IHs002002Service) ctx.getBean("Hs002002Service");
后问题解决。
在分享和总结中成长。
浙公网安备 33010602011771号