码迷,mamicode.com
首页 > 编程语言 > 详细

spring 解决冲突,配置拦截器与jackson转化支持

时间:2017-12-22 19:45:37      阅读:326      评论:0      收藏:0      [点我收藏+]

标签:beans   efault   使用   转化   www.   buffere   image   for   支持   

<?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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd"
    default-lazy-init="true">

<mvc:interceptors>
    <mvc:interceptor>
        <mvc:mapping path="/api/admin/**/*.jspx"/> 
        <bean id="frontAPIInterceptor" class="com.yssjcms.cms.web.FrontAPIInterceptor"/>
    </mvc:interceptor>
    <mvc:interceptor>
        <mvc:mapping path="/**"/> 
        <mvc:exclude-mapping path="/api/admin/**/*.jspx"/>
        <bean id="frontContextInterceptor" class="com.yssjcms.cms.web.FrontContextInterceptor"/>
    </mvc:interceptor>
    <mvc:interceptor>
        <mvc:mapping path="/**"/> 
        <mvc:exclude-mapping path="/api/admin/**/*.jspx"/>
        <bean id="frontLocaleInterceptor" class="com.yssjcms.cms.web.FrontLocaleInterceptor"/>
    </mvc:interceptor>
</mvc:interceptors>
<mvc:annotation-driven>
    <mvc:message-converters register-defaults="false"> <!-- 不使用默认配置 -->
        <bean class="org.springframework.http.converter.StringHttpMessageConverter" />
        <bean class="org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter" />
        <bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter" />
        <bean class="org.springframework.http.converter.BufferedImageHttpMessageConverter" />
        <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" >
            <property name="supportedMediaTypes"> 
                <list>
                    <value>text/html;charset=UTF-8</value>
                    <value>application/json;charset=UTF-8</value>
                </list>
            </property>
        </bean>
    </mvc:message-converters>
</mvc:annotation-driven>

    <context:annotation-config/>
</beans>

 

spring 解决冲突,配置拦截器与jackson转化支持

标签:beans   efault   使用   转化   www.   buffere   image   for   支持   

原文地址:http://www.cnblogs.com/codeinet/p/8087245.html

(0)
(1)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!