spring-web-context.xml 3.47 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:task="http://www.springframework.org/schema/task" xmlns:util="http://www.springframework.org/schema/util"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p"
	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/util
                        http://www.springframework.org/schema/util/spring-util.xsd
                        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/task
                        http://www.springframework.org/schema/task/spring-task.xsd">

	<aop:aspectj-autoproxy />
	<context:property-placeholder ignore-resource-not-found="true" location="classpath*:config.properties" />

	<context:component-scan base-package="com.yoho.rfid" />
	<!-- warn email cc accounts -->
	<util:list id="ccAccounts" value-type="java.lang.String">
		<value>frank.fu@yoho.cn</value>
		<value>xiuchun.luo@yoho.cn</value>
		<value>rongjun.zhou@yoho.cn</value>
		<value>qiqi.zhou@yoho.cn</value>
		<value>jon.huang@yoho.cn</value>
		<value>chao.chen@yoho.cn</value>
	</util:list>
	<!-- 启动SpringMVC的注解功能,完成请求和注解POJO的映射 -->
	<mvc:annotation-driven>
		<mvc:message-converters register-defaults="false">
			<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>

	<bean id="service-restTemplate" class="org.springframework.web.client.RestTemplate">
		<property name="messageConverters">
			<list>
				<bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter"/>
				<bean class="org.springframework.http.converter.StringHttpMessageConverter">
					<property name="supportedMediaTypes">
						<list>
							<value>text/plain;charset=UTF-8</value>
							<value>text/html;charset=UTF-8</value>
							<value>text/xml;charset=GBK</value>
						</list>
					</property>
				</bean>
				<bean class="org.springframework.http.converter.ResourceHttpMessageConverter"/>
				<bean class="org.springframework.http.converter.FormHttpMessageConverter"/>
				<bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
					<property name="supportedMediaTypes" value="application/json;charset=UTF-8"/>
				</bean>
			</list>
		</property>
	</bean>

</beans>