在web项目中引入spring
在web.xml中添加
<!-- 配置Spring配置文件的位置 --><context-param><param-name>contextConfigLocation</param-name><param-value>/WEB-INF/applicationContext.xml,/WEB-INF/daoContext.xml</param-value></context-param><!-- 使用ContextLoaderListener初始化Spring容器 --><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>
所需jar包
