1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns="http://www.springframework.org/schema/beans" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" 4 xmlns:mvc="http://www.springframework.org/schema/mvc" 5 xsi:schemaLocation="http://www.springframework.org/schema/beans 6 http://www.springframework.org/schema/beans/spring-beans.xsd 7 http://www.springframework.org/schema/context 8 http://www.springframework.org/schema/context/spring-context.xsd 9 http://www.springframework.org/schema/mvc 10 http://www.springframework.org/schema/mvc/spring-mvc.xsd"> 11 12 <!-- 开启mvc注解模式 --> 13 <mvc:annotation-driven /> 14 15 <!-- 配置扫描web包下Controller注解的类 --> 16 <context:component-scan base-package="com.imooc.o2o.web" /> 17 18 <!-- 静态资源默认servlet配置,1、加入对静态资源默认处理包括图片,js,css; --> 19 <mvc:resources location="/resources/" mapping="/resources/**" /> 20 <!-- 2、允许 / 整整体映射 --> 21 <mvc:default-servlet-handler /> 22 23 <bean 24 class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 25 <property name="prefix" value="/WEB-INF/html" /> 26 <property name="suffix" value=".html" /> 27 </bean> 28 29 </beans>