Alatus Lee 3419cc6e7f 提交
2025-10-05 17:41:23 +08:00

118 lines
5.2 KiB
XML

<?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:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:cache="http://www.springframework.org/schema/cache"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache-4.3.xsd">
<aop:aspectj-autoproxy/>
<context:annotation-config />
<context:component-scan base-package="com.mcg">
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
</context:component-scan>
<context:component-scan base-package="com.mcg.controller"/>
<bean class="org.springframework.validation.beanvalidation.MethodValidationPostProcessor">
<property name="validator" ref="validator"/>
</bean>
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
<property name="providerClass" value="org.hibernate.validator.HibernateValidator"/>
<property name="validationMessageSource" ref="messageSource"/>
</bean>
<mvc:annotation-driven validator="validator">
<mvc:message-converters register-defaults="true">
<ref bean="fastJsonHttpMessageConverter"/>
</mvc:message-converters>
</mvc:annotation-driven>
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<list>
<value>classpath:messages</value>
<value>classpath:org/hibernate/validator/ValidationMessages</value>
</list>
</property>
<property name="useCodeAsDefaultMessage" value="false"/>
<property name="defaultEncoding" value="UTF-8"/>
<property name="cacheSeconds" value="60"/>
</bean>
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
<property name="cookieName" value="language"/>
<property name="cookieMaxAge" value="3600"/>
<property name="defaultLocale" value="zh_CN"/>
</bean>
<bean id="fastJsonHttpMessageConverter" class="com.mcg.common.FastJsonHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>application/json</value>
</list>
</property>
<property name="dateFormat" value="yyyy-MM-dd HH:mm:ss"/>
<property name="features">
<list>
<value>DisableCircularReferenceDetect</value>
</list>
</property>
</bean>
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<ref bean="fastJsonHttpMessageConverter" />
</list>
</property>
</bean>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/template/"/>
<property name="suffix" value=".jsp"/>
</bean>
<mvc:default-servlet-handler />
<mvc:resources mapping="/js/**" location="/library/js/"/>
<mvc:resources mapping="/css/**" location="/library/css/"/>
<mvc:interceptors>
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="language"/>
</bean>
<mvc:interceptor>
<mvc:mapping path="/**/**"/>
<mvc:exclude-mapping path="/login"/>
<mvc:exclude-mapping path="/*/*/*.js"/>
<mvc:exclude-mapping path="/*/*/*/*/*.js"/>
<mvc:exclude-mapping path="/*/*/*/*/*.css"/>
<bean class="com.mcg.interceptor.LoginHandlerInterceptor" />
</mvc:interceptor>
</mvc:interceptors>
<bean class="com.mcg.common.SpringContextHelper"/>
<bean id="cacheManager"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="classpath:ehcache.xml" />
</bean>
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" p:defaultEncoding="utf-8">
<property name="maxUploadSize" value="5242880" />
<property name="maxInMemorySize" value="1024" />
</bean>
<bean id="mcgTask" class="com.mcg.plugin.task.McgTask" init-method="init"></bean>
</beans>