整合时,要想使用Spring的IOC容器,一定要在web.xml中配置spring的配置文件()在刚开始练习时,出现无法注入的问题,以此提醒自己)
<!--监听servletContext对象的创建-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!--配置spring配置文件的加载-->
<!--tomcat启动时,会为每个web项目创建一个servletcontext对象,这个对象初始化时会执行context-param标签-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:ApplicationContext.xml</param-value>
</context-param>