欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JSP 獲取Spring 注入對象示例

 更新時間:2014年07月09日 17:47:27   投稿:whsnow  
這篇文章主要介紹了JSP如何獲取Spring 注入對象,實現(xiàn)代碼如下,需要的朋友不要錯過
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@ page import="org.springframework.context.ApplicationContext"%>

ServletContext sc = this.getServletConfig().getServletContext();
ApplicationContext ac2 = WebApplicationContextUtils.getWebApplicationContext(sc);

要獲取的對象 serv = (要獲取的對象) ac2.getBean("spring配置文件中的id");

相關(guān)文章

最新評論