在Controller中经过非注解的方式获取spring和springMVC上下文的方式

在Controller中须要有参数
spring

如:.net

public void  testController(HttpServletRequest request){blog

    //Spring上下文
        WebApplicationContext ac1=     WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());
    //springMVC上下文
        WebApplicationContext ac2 = RequestContextUtils.getWebApplicationContext(request);get

}
io

对比一下struts2 对上下文的获取;
test

http://blog.csdn.net/lxl_family/article/details/12715337struts2

相关文章
相关标签/搜索