关键代码:companyDao只是我自己用的一个Bean,可以替换成所需的Bean。
- <%@ page import="org.springframework.context.ApplicationContext"%>
- <%@ page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
- <%
- ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());
- CompanyDao companyDao= (CompanyDao)ctx.getBean("companyDao");
- %>
本文介绍了一种在Spring MVC环境中通过使用WebApplicationContextUtils获取应用上下文,并从中注入CompanyDao组件的方法。
3395

被折叠的 条评论
为什么被折叠?



