本文共 547 字,大约阅读时间需要 1 分钟。
spring集成web
①在web.xml中配置ContextLoaderListener监听器(导入spring-web坐标)
org.springframework spring-web 5.3.1
②使用WebApplicationContextUtils获得应用上下文对象ApplicationContextcontextConfigLocation classpath:appliactionContext.xml org.springframework.web.context.ContextLoaderListener
ServletContext servletContext = this.getServletContext();WebApplicationContext app = WebApplicationContextUtils.getWebApplicationContext(servletContext);
转载地址:http://aheu.baihongyu.com/