|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
|
|
|
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
|
|
|
|
xmlns:context="http://www.springframework.org/schema/context"
|
|
|
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
|
|
|
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">
|
|
|
|
|
<!--开启IOC注解支持-->
|
|
|
|
|
<!--包扫描,指定控制类-->
|
|
|
|
|
<context:component-scan base-package="club.controller"/>
|
|
|
|
|
|
|
|
|
|
<!--mvc的注解支持-->
|
|
|
|
|
<mvc:annotation-driven>
|
|
|
|
|
<!--消息转换器 转json过程中,将时间类型的数据转成String-->
|
|
|
|
|
<mvc:message-converters>
|
|
|
|
|
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
|
|
|
|
|
<property name="objectMapper">
|
|
|
|
|
<bean class="com.fasterxml.jackson.databind.ObjectMapper">
|
|
|
|
|
<property name="dateFormat">
|
|
|
|
|
<bean class="java.text.SimpleDateFormat">
|
|
|
|
|
<constructor-arg type="java.lang.String" value="yyyy-MM-dd" />
|
|
|
|
|
</bean>
|
|
|
|
|
</property>
|
|
|
|
|
</bean>
|
|
|
|
|
</property>
|
|
|
|
|
</bean>
|
|
|
|
|
</mvc:message-converters>
|
|
|
|
|
</mvc:annotation-driven>
|
|
|
|
|
|
|
|
|
|
<!--访问静态资源-->
|
|
|
|
|
<mvc:resources mapping="/static/**" location="/static/"/>
|
|
|
|
|
|
|
|
|
|
<!--处理器映射器-->
|
|
|
|
|
<!--<bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"></bean>-->
|
|
|
|
|
|
|
|
|
|
<!--视图解析器-->
|
|
|
|
|
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
|
|
|
|
<!--给处理器返回的映射路径添加前缀 后缀-->
|
|
|
|
|
<property name="prefix" value="/WEB-INF/jsp/"/>
|
|
|
|
|
<property name="suffix" value=".jsp"/>
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<!--拦截器-->
|
|
|
|
|
<!--没写拦截器,这部分内容忽略-->
|
|
|
|
|
<!--<mvc:interceptors>
|
|
|
|
|
<mvc:interceptor>
|
|
|
|
|
<mvc:mapping path="/**"/>
|
|
|
|
|
<mvc:exclude-mapping path="/user/login"/>
|
|
|
|
|
<mvc:exclude-mapping path="/user/dologin"/>
|
|
|
|
|
<mvc:exclude-mapping path="/statics/**"/>
|
|
|
|
|
<bean class="club.interceptors.LoginInterceptor"/>
|
|
|
|
|
</mvc:interceptor>
|
|
|
|
|
<mvc:interceptor>
|
|
|
|
|
<mvc:mapping path="/sys/pro*"/>
|
|
|
|
|
<mvc:mapping path="/sys/*provider"/>
|
|
|
|
|
<mvc:exclude-mapping path="/statics/**"/>
|
|
|
|
|
<bean class="club.interceptors.ProviderInterceptor"/>
|
|
|
|
|
</mvc:interceptor>
|
|
|
|
|
<mvc:interceptor>
|
|
|
|
|
<mvc:mapping path="/sys/user*"/>
|
|
|
|
|
<mvc:mapping path="/sys/*User"/>
|
|
|
|
|
<mvc:exclude-mapping path="/statics/**"/>
|
|
|
|
|
<bean class="club.interceptors.UserInterceptor"/>
|
|
|
|
|
</mvc:interceptor>
|
|
|
|
|
</mvc:interceptors>-->
|
|
|
|
|
|
|
|
|
|
<!--异常处理-->
|
|
|
|
|
<bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
|
|
|
|
|
<property name="exceptionMappings">
|
|
|
|
|
<props>
|
|
|
|
|
<prop key="java.lang.Exception">user/error</prop>
|
|
|
|
|
</props>
|
|
|
|
|
</property>
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<!--文件上传设置-->
|
|
|
|
|
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
|
|
|
|
<property name="defaultEncoding" value="UTF-8"/>
|
|
|
|
|
<!--设置文件最大上传大小,超过最大值会提示无法访问-->
|
|
|
|
|
<property name="maxUploadSize" value="5000000"/>
|
|
|
|
|
</bean>
|
|
|
|
|
</beans>
|