44 lines
1.9 KiB
XML
44 lines
1.9 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:mvc="http://www.springframework.org/schema/mvc"
|
|
xmlns:context="http://www.springframework.org/schema/context"
|
|
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:task="http://www.springframework.org/schema/task"
|
|
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
|
|
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
|
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd">
|
|
<!-- only scan the Controller class for web context -->
|
|
<context:component-scan base-package="com.github.binarywang.demo.spring">
|
|
<context:include-filter type="annotation"
|
|
expression="org.springframework.stereotype.Controller" />
|
|
</context:component-scan>
|
|
|
|
<mvc:annotation-driven>
|
|
<mvc:message-converters>
|
|
<ref bean="jsonConverter" />
|
|
<ref bean="stringHttpMessageConverter" />
|
|
</mvc:message-converters>
|
|
</mvc:annotation-driven>
|
|
|
|
<mvc:default-servlet-handler />
|
|
|
|
<bean id="stringHttpMessageConverter"
|
|
class="org.springframework.http.converter.StringHttpMessageConverter">
|
|
<property name="supportedMediaTypes">
|
|
<list>
|
|
<value>text/html;charset=UTF-8</value>
|
|
<value>text/plain;charset=UTF-8</value>
|
|
</list>
|
|
</property>
|
|
</bean>
|
|
|
|
<bean id="jsonConverter"
|
|
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
|
|
<property name="supportedMediaTypes" value="application/json" />
|
|
</bean>
|
|
|
|
<aop:aspectj-autoproxy proxy-target-class="true" />
|
|
|
|
</beans>
|