前言:
可能作者的层次较高,并没有考虑到SpringMVC+Spring的配置还有新人自学不知道吧。捂脸!
正文:
一、配置整合springmvc+spring:
1、在src也就是classpath下新建spring-serlvet.xml配置文件,用来配置spring容器的bean:扫描model文件夹下所有。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
<context:component-scan base-package="model"></context:component-scan>
</beans>
2、在WEB-INF下配置spring-servlet.xml,配置springmvc
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springfr