|
|
<?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:aop="http://www.springframework.org/schema/aop"
|
|
|
xmlns:context="http://www.springframework.org/schema/context"
|
|
|
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
|
|
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
|
|
|
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd">
|
|
|
|
|
|
<!-- 配置扫描器
|
|
|
只扫描标了@Controller的控制器
|
|
|
use-default-filters="false"禁用掉默认的过滤行为,只包含才会生效。即:
|
|
|
<context:component-scan base-package="com.ssm" use-default-filters="false">
|
|
|
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
|
|
|
</context:component-scan> -->
|
|
|
<!-- <context:component-scan base-package="com.ssm"></context:component-scan> -->
|
|
|
<context:component-scan base-package="com.ssm" use-default-filters="false">
|
|
|
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
|
|
|
</context:component-scan>
|
|
|
|
|
|
<!-- 视图解析器 -->
|
|
|
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
|
|
<property name="prefix" value="/WEB-INF/jsp/"></property> <!-- 前缀 -->
|
|
|
<property name="suffix" value=".jsp"></property> <!-- 后缀 -->
|
|
|
</bean>
|
|
|
|
|
|
<!-- 处理动态资源,是SpringMVC的基础配置,可以协调很多功能,一般写SpringMVC项目都加上 -->
|
|
|
<mvc:annotation-driven></mvc:annotation-driven>
|
|
|
<!-- 正确的处理静态资源 -->
|
|
|
<mvc:default-servlet-handler/>
|
|
|
<bean class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
|
|
|
|
|
|
</bean>
|
|
|
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
|
|
<property name="maxUploadSize">
|
|
|
<value>5242880</value>
|
|
|
</property>
|
|
|
</bean>
|
|
|
</beans>
|