您的位置:首页 > 移动开发

获取Application中的spring容器

2015-03-02 09:33 176 查看
方式1:
ApplicationContext ac = (ApplicationContext) invocation.getInvocationContext().getApplication().get(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);

方式2:
ServletContext sc = ServletActionContext.getServletContext();
ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(sc);


  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: