JSP中如何获取spring 容器呢?
- // 获取spring容器
- ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
- // 插件数据初始化
- ICommonService commonService = (ICommonService) ctx.getBean("commonService");
- commonService.init();
- ServletContext context = request.getSession().getServletContext();
- ApplicationContext ctx = WebApplicationContextUtils
- .getWebApplicationContext(context);
时间: 2024-11-30 23:59:06