首页 > 编程语言 > 详细

JSP中获取spring 容器

时间:2015-01-19 02:11:28      阅读:175      评论:0      收藏:0      [点我收藏+]

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);

?

JSP中获取spring 容器

原文:http://hw1287789687.iteye.com/blog/2177093

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!