获取Application中的spring容器

方式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 @ 2015-03-02 09:33  a757956132  阅读(289)  评论(0编辑  收藏  举报