spring-global-common.xml
3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- rest template -->
<bean id="service-httpClient" class="com.yoho.core.common.http.HttpClientsFactory">
<property name="connectionRequestTimeout" value="6000"/>
<property name="socketTimeout" value="1900"/>
<property name="connectionTimeout" value="6000"/>
<property name="maxTotal" value="30"/>
<property name="defaultMaxPerRoute" value="10"/>
</bean>
<bean id="service-clientHttpRequestFactory"
class="org.springframework.http.client.HttpComponentsClientHttpRequestFactory">
<constructor-arg ref="service-httpClient"/>
</bean>
<bean id="service-restTemplate" class="org.springframework.web.client.RestTemplate">
<constructor-arg ref="service-clientHttpRequestFactory"/>
<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/plain;charset=utf-8</value>
<value>text/html;charset=UTF-8</value>
<value>text/html;charset=utf-8</value>
<value>text/xml;charset=GBK</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>
<bean id="yhRestCaller" class="com.yoho.global.common.rest.client.YHRestCaller">
<property name="restTemplate" ref="service-restTemplate"/>
<property name="yhbUrl" value="${yhb_api_url:http://api.yoho.cn}"/>
<property name="yhbClientType" value="${yhb_client_type:web}"/>
<property name="yhbClientKey" value="${yhb_client_key:0ed29744ed318fd28d2c07985d3ba633}"/>
<property name="keyConfigMap" ref="securityConfigMap" />
</bean>
<bean id="securityConfigMap" class="org.springframework.beans.factory.config.YamlMapFactoryBean">
<property name="resources">
<list>
<value>classpath:security-key.yml</value>
</list>
</property>
</bean>
</beans>