获取Application中的spring容器

1
2
3
4
5
6
7
方式1
ApplicationContext ac = (ApplicationContext) invocation.getInvocationContext().getApplication().get(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
 
方式2:       
        ServletContext sc = ServletActionContext.getServletContext();
        ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(sc);
        

  

posted @   a757956132  阅读(292)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示