<?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>