123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <?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.xsd
- http://www.springframework.org/schema/mvc
- http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context.xsd">
- <mvc:default-servlet-handler/>
- <!--RequestMappingHandlerAdapter-->
- <mvc:annotation-driven>
- <mvc:message-converters>
- <ref bean="stringHttpMessageConverter"/>
- <ref bean="marshallingHttpMessageConverter"/>
- <ref bean="mappingJackson2HttpMessageConverter"/>
- </mvc:message-converters>
- </mvc:annotation-driven>
- <context:component-scan base-package="com.yc.education.controller.demo"/>
- <context:component-scan base-package="com.yc.education.controller"/>
- <bean id="stringHttpMessageConverter"
- class="org.springframework.http.converter.StringHttpMessageConverter"/>
- <bean id="marshallingHttpMessageConverter"
- class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">
- <property name="marshaller" ref="castorMarshaller"/>
- <property name="unmarshaller" ref="castorMarshaller"/>
- </bean>
- <bean id="mappingJackson2HttpMessageConverter"
- class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
- <property name="supportedMediaTypes">
- <list>
- <value>application/json</value>
- <value>application/xml</value>
- <value>text/html</value>
- <value>text/plain</value>
- <value>text/xml</value>
- </list>
- </property>
- </bean>
- <bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller"/>
- <!--信息转换 - 结束-->
- <bean id="contentNegotiationManagerFactoryBean"
- class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
- <property name="defaultContentType" value="text/html"/>
- <property name="ignoreAcceptHeader" value="true"/>
- <property name="favorPathExtension" value="true"/>
- <property name="favorParameter" value="false"/>
- <property name="mediaTypes">
- <map>
- <entry key="atom" value="application/atom+xml"/>
- <entry key="html" value="text/html"/>
- <entry key="json" value="application/json"/>
- </map>
- </property>
- </bean>
- <!--内容协商-->
- <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
- <property name="contentNegotiationManager">
- <bean class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
- <property name="defaultContentType" value="text/html"/>
- <property name="mediaTypes">
- <map>
- <entry key="json" value="application/json"/>
- <entry key="xml" value="application/xml"/>
- <entry key="html" value="text/html"/>
- </map>
- </property>
- </bean>
- </property>
- <property name="viewResolvers">
- <list>
- <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- <property name="prefix" value="/WEB-INF/jsp/"/>
- <property name="suffix" value=".jsp"/>
- </bean>
- </list>
- </property>
- <property name="defaultViews">
- <list>
- <bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView"/>
- <bean class="org.springframework.web.servlet.view.xml.MarshallingView">
- <property name="marshaller" ref="castorMarshaller"/>
- </bean>
- </list>
- </property>
- </bean>
- <!--国际化-->
- <bean id="messageSource"
- class="org.springframework.context.support.ResourceBundleMessageSource">
- <property name="defaultEncoding" value="UTF-8"/>
- <property name="basenames">
- <list>
- <value>messages.welcome</value>
- </list>
- </property>
- </bean>
- <!--文件上传-->
- <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
- <property name="maxUploadSize" value="10000000000"/>
- </bean>
- <!-- 全局拦截器配置文件 Start -->
- <mvc:interceptors>
- <mvc:interceptor>
- <mvc:mapping path="/**"/>
- <bean class="com.yc.education.interceptor.GlobalInterceptor" />
- </mvc:interceptor>
- </mvc:interceptors>
- <!-- 全局拦截器配置文件 End -->
- </beans>
|