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" 4 xmlns:context="http://www.springframework.org/schema/context" 5 xmlns:mvc="http://www.springframework.org/schema/mvc" 6 xmlns:aop="http://www.springframework.org/schema/aop" 7 xsi:schemaLocation="http://www.springframework.org/schema/beans 8 http://www.springframework.org/schema/beans/spring-beans.xsd 9 http://www.springframework.org/schema/context 10 http://www.springframework.org/schema/context/spring-context.xsd 11 http://www.springframework.org/schema/mvc 12 http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd"> 13 <!-- 配置springMVC --> 14 <!--1.开启springMVC注解模式 --> 15 <mvc:annotation-driven/> 16 <!--2.静态资源默认servlet配置 17 (1)加入对静态资源的处理:js,gif,png 18 (2)允许使用"/"做整体映射 19 --> 20 <mvc:resources location="/resources/" mapping="/resources/**"/> 21 <mvc:default-servlet-handler/> 22 23 <!--3.定义视图解析器 --> 24 <bean id="viewResolver" 25 class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 26 <property name="prefix" value="/WEB-INF/html/"></property> 27 <property name="suffix" value=".html"></property> 28 </bean> 29 30 <!--4.扫描web相关的bean --> 31 <context:component-scan base-package="com.imooc.controller"/> 32 </beans> 33 34 35 36 37 38 39 40 41 42 43 44 45 46
来源:https://www.cnblogs.com/shitulaoma/p/12393232.html