<?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/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!--扫描注解-->
<context:component-scan base-package="com.sxt.controller"/>
<!--注解驱动-->
<mvc:annotation-driven></mvc:annotation-driven>
<!--静态资源-->
<mvc:resources mapping="/files/**" location="/files/"/>
<!--视图解析器-->
<bean name="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- 配置前缀 -->
<property name="prefix" value="/"></property>
<!-- 配置后缀 -->
<property name="suffix" value=".jsp"></property>
</bean>
<!--multipart解析器-->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/>
</beans>
springmvc.xml配置
最新推荐文章于 2021-12-28 23:19:04 发布
本文详细介绍了 Spring MVC 的配置过程,包括扫描注解、启用注解驱动、配置静态资源映射、设置视图解析器及multipart解析器等内容,为读者提供了一个完整的Spring MVC配置示例。
1390

被折叠的 条评论
为什么被折叠?



