雄安一机游管理后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
phonetour2.0/target/classes/WEB-INF/spring-servlet.xml

148 lines
5.9 KiB

<?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:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!--静态资源配置 -->
<!-- <mvc:resources mapping="/assets/**" location="/assets/" cache-period="31556926"/>
<mvc:resources mapping="/css/**" location="/css/" cache-period="31556926"/>
<mvc:resources mapping="/js/**" location="/js/" cache-period="31556926"/>
<mvc:resources mapping="/images/**" location="/images/" cache-period="31556926"/>
<mvc:resources mapping="/login/**" location="/login/" cache-period="31556926"/> -->
<!-- <mvc:view-controller path="/" view-name="/login/doLogin.do" /> -->
<!-- Spring MVC不处理静态资源 -->
<mvc:default-servlet-handler />
<!-- 支持mvc注解驱动 -->
<mvc:annotation-driven conversion-service="conversionService" />
<bean id="conversionService"
class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
<property name="converters">
<list>
</list>
</property>
</bean>
<!--自动注释 -->
<!-- <context:annotation-config /> -->
<!-- 设置使用注解的类所在的jar包 -->
<!-- <context:component-scan base-package="com.cjy.*" use-default-filters="false">
</context:component-scan> -->
<context:component-scan base-package="com.cjy.*">
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Repository" />
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Service" />
</context:component-scan>
<bean
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/html/back/" p:suffix=".html" />
<!-- <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="defaultEncoding" value="utf-8" /> <property name="maxUploadSize"
value="10485760000" /> <property name="maxInMemorySize" value="40960" />
</bean> -->
<mvc:interceptors>
<!-- session超时 -->
<mvc:interceptor>
<mvc:mapping path="/*/*" />
<bean class="com.cjy.interceptor.AdminInterceptor">
<property name="loginUrl" value="/html/back/login.html" />
<property name="allowUrls">
<list>
<!-- 如果请求中包含以下路径,则不进行拦截 -->
<value>/login</value>
<value>/js</value>
<value>/css</value>
<value>/image</value>
<value>/img</value>
<value>/images</value>
<value>/index</value>
<value>/system</value>
<value>/tourism</value>
<value>/food</value>
<value>/upfeed</value>
<value>/hotel</value>
<value>/entertainment</value>
<value>/shopping</value>
<value>/upload</value>
<value>/mobile</value>
<!-- <value>/stat</value>-->
<value>/ybsjSysParam/selectParamByUserKey</value>
<value>/ybsjSysParam/adminChart</value>
</list>
</property>
</bean>
</mvc:interceptor>
</mvc:interceptors>
<!--定义一个Interceptor,将拦截所有的请求 -->
<!-- <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/**"/> <bean
class="com.cjy.interceptor.LogInterceptor"/> </mvc:interceptor> </mvc:interceptors> -->
<bean id="exceptionResolver"
class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="exceptionMappings">
<props>
<!-- 遇到MaxUploadSizeExceededException异常时,自动跳转到/WEB-INF/jsp/error_fileupload.jsp页面 -->
<prop
key="org.springframework.web.multipart.MaxUploadSizeExceededException"></prop>
</props>
</property>
</bean>
<!-- 启动Springmvc注解驱动 -->
<mvc:annotation-driven />
<!-- 返回json 方法一 需要导入 fastjson.jar包 -->
<mvc:annotation-driven>
<mvc:message-converters register-defaults="false">
<!-- 避免IE执行AJAX时,返回JSON出现下载文件 -->
<bean id="fastJsonHttpMessageConverter"
class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<!-- 这里顺序不能反,一定先写text/html,不然ie下出现下载提示 -->
<value>text/html;charset=UTF-8</value>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<!-- 默认的注解映射的支持 -->
<mvc:annotation-driven validator="validator"
conversion-service="conversion-service" />
<bean id="validator"
class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
<property name="providerClass" value="org.hibernate.validator.HibernateValidator" />
<!--不设置则默认为classpath下的 ValidationMessages.properties -->
<property name="validationMessageSource" ref="validatemessageSource" />
</bean>
<bean id="conversion-service"
class="org.springframework.format.support.FormattingConversionServiceFactoryBean" />
<bean id="validatemessageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:/config/validatemessages" />
<property name="fileEncodings" value="utf-8" />
<property name="cacheSeconds" value="120" />
</bean>
</beans>