<?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:context="http://www.springframework.org/schema/context"
|
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:aop="http://www.springframework.org/schema/aop"
|
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:cache="http://www.springframework.org/schema/cache"
|
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
|
http://www.springframework.org/schema/tx
|
http://www.springframework.org/schema/tx/spring-tx.xsd
|
http://www.springframework.org/schema/aop
|
http://www.springframework.org/schema/aop/spring-aop.xsd
|
http://www.springframework.org/schema/cache
|
http://www.springframework.org/schema/cache/spring-cache.xsd">
|
|
<!-- 启动包扫描功能,以便注册带有@Controllers等注解的类成为spring的bean -->
|
<context:component-scan base-package="com.ruili.**.controller,com.ruili.wcp.web.api,com.zbooksoft.**.controller"/>
|
|
<!-- AOP 注解方式 ;定义Aspect -->
|
<!-- 启动AspectJ支持 只对扫描过的bean有效 -->
|
<aop:aspectj-autoproxy proxy-target-class="true"/>
|
|
<!-- 全局异常处理类 -->
|
<bean class="com.ruili.wcp.web.common.SpringHandlerExceptionResolver"/>
|
|
<!-- 配置视图解析器 -->
|
<bean
|
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
<property name="viewClass"
|
value="org.springframework.web.servlet.view.JstlView"/>
|
<property name="prefix" value="/WEB-INF/view/"/> <!-- 前缀 -->
|
<property name="suffix" value=".jsp"/> <!-- 后缀 -->
|
</bean>
|
|
<!-- 配置注解的处理器映射器和处理器适配器 -->
|
<mvc:annotation-driven>
|
<mvc:message-converters>
|
<!-- 在输出到前台时,将long类型转换为string,以免精度丢失 -->
|
<bean
|
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
|
<property name="objectMapper">
|
<!-- <bean class="com.fasterxml.jackson.databind.ObjectMapper"> -->
|
<bean class="com.ruili.wcp.web.common.LongToStringAdapter">
|
<property name="dateFormat">
|
<bean class="java.text.SimpleDateFormat">
|
<constructor-arg type="java.lang.String" value="yyyy-MM-dd HH:mm:ss"/>
|
</bean>
|
</property>
|
</bean>
|
</property>
|
</bean>
|
</mvc:message-converters>
|
</mvc:annotation-driven>
|
|
<!-- 多部分文件上传 -->
|
<bean id="multipartResolver"
|
class="com.ruili.wcp.web.filter.CustomMultipartResolver">
|
<property name="maxUploadSize" value="10737418240"/>
|
<property name="maxInMemorySize" value="40960"/>
|
<property name="defaultEncoding" value="UTF-8"/>
|
</bean>
|
|
<mvc:interceptors>
|
<mvc:interceptor>
|
<mvc:mapping path="/general/**"/>
|
<bean class="com.ruili.wcp.web.interceptor.RequireLoginInterceptor">
|
<property name="interceptorMappers" ref="interceptorMappers"/>
|
</bean>
|
</mvc:interceptor>
|
</mvc:interceptors>
|
|
<bean id="interceptorMappers" class="com.ruili.wcp.web.interceptor.RequireLoginInterceptor.InterceptorMappers">
|
<property name="mappers" value="flag"/>
|
</bean>
|
|
<!-- 访问静态文件(jpg,js,css)的方法 -->
|
<mvc:resources location="/static/" mapping="/static/**"/>
|
<mvc:resources location="/upload/" mapping="/upload/**"/>
|
|
|
<!-- 开启shiro注解 -->
|
<bean
|
class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"
|
depends-on="lifecycleBeanPostProcessor">
|
<property name="proxyTargetClass" value="true"/>
|
</bean>
|
|
<bean
|
class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
|
<property name="securityManager" ref="securityManager"/>
|
</bean>
|
</beans>
|