spring-web-context.xml 2.27 KB
<?xml  version="1.0" encoding="UTF-8"?>
<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"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns="http://www.springframework.org/schema/beans"
       xmlns:task="http://www.springframework.org/schema/task"
	xsi:schemaLocation="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/aop
                        http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
                        http://www.springframework.org/schema/mvc
                        http://www.springframework.org/schema/mvc/spring-mvc.xsd
                        http://www.springframework.org/schema/task
                        http://www.springframework.org/schema/task/spring-task.xsd">

	<context:property-placeholder location="classpath:/product/*.properties" />
	<context:component-scan base-package="com.monitor" />
    <!-- 打开aop 注解 -->
    <aop:aspectj-autoproxy proxy-target-class="true"/>
    <!-- 支持异步方法执行 -->
    <task:annotation-driven />

	<!-- Enables the Spring Task @Scheduled programming model -->
	<task:executor id="executor" pool-size="50"/>
	<task:scheduler id="scheduler" pool-size="50"/>
	<task:annotation-driven executor="executor" scheduler="scheduler"/>

    <mvc:annotation-driven>
		<mvc:message-converters>
			<ref bean="stringConverter" />
			<ref bean="jsonConverter" />
		</mvc:message-converters>
	</mvc:annotation-driven>
	
	<!--字符串转换器 -->
	<bean id="stringConverter" class="org.springframework.http.converter.StringHttpMessageConverter">
		<property name="supportedMediaTypes">
			<list>
				<value>text/plain;charset=UTF-8</value>
				<value>text/html;charset=UTF-8</value>
			</list>
		</property>
	</bean>
	
	<!-- json转换器 application/json -->
	<bean id="jsonConverter" class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
	</bean>

</beans>