<?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:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!--配置springMVC-->
<!--1.开启springmvc注解模式-->
<!--简化配置
1)自动注册DefaultAnnotationHandlerMapping,AnnotationMethodHandlerAdapter
2)提供一系列:数据绑定,数字和日期的format @NumberFormat @DataTimeFormat,
xml,json默认读写支持
-->
<mvc:annotation-driven />
<!--servlet-mapping 映射路径: "/"-->
<!--2:静态资源默认sevlet配置
1:加入对静态资源的处理:js,gif,png
2:允许使用"/"做整体映射
-->
<mvc:default-servlet-handler />
<!--3:配置jsp显示ViewResolver-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
<!--4:扫描web相关的bean-->
<context:component-scan base-package="包名"/>
</beans>