一、spring与servlet整合
1.在xml中配置
//配置IOC容器配置文件位置
<context-param>
<param-name>任意名</param-name>
<param-value>classpath:spring配置文件全名或spring配置文件路径</param-value>
</context-param>
//启动 Spring 的 IOC 容器
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
2.在servlet中调用spring配置文件中的bean类
WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext()).getBean("bean类引用名");