求助啊!怎么获得啊。
引入jar包,配置ServletContext servletContext = this.getServletContext();
web.xml里边没有配置<context>标签及监听器,
servelt初始化方法init()里边也要加上context初始化的代码
web.xml里边加上
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
</context-param>
Servlet的初始化方法init()里加上
ServletContext servletContext = this.getServletContext();
applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
别忘引入相应的jar包