spring-mvc.xml配置文件主要用于配置SpringMVC视图解析器、控制器、部分静态资源等。
type:Spring Bean Configuration File
<?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/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
<!--网站跳转控制 -->
<!-- 扫描controller -->
<context:component-scan base-package="com.atguigu.crud.controller"></context:component-scan>
<!-- 视图解析器 -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- 配置jsp路径的前缀 -->
<property name="prefix" value="/WEB-INF/views/" />
<!-- 配置jsp路径的后缀 -->
<property name="suffix" value=".jsp" />
</bean>
<!--两个标准 -->
<!--将springmvc不能处理的请求交给tomcat,指用户对静态资源的请求 -->
<mvc:default-servlet-handler/>
<!--支持springmvc一些更高级的功能,jsr303校验,快捷的ajax。。。。映射动态请求 -->
<mvc:annotation-driven></mvc:annotation-driven>
</beans>