spring-info.xml 3.15 KB
<?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:p="http://www.springframework.org/schema/p" 
	xmlns:context="http://www.springframework.org/schema/context" 
	xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
       http://www.springframework.org/schema/context
	   http://www.springframework.org/schema/context/spring-context-3.1.xsd">
	
	<bean id="dnsConfig" class="com.monitor.other.dns.common.DNSConfig">
		<constructor-arg name="url" value="${dns.config.url}" />
		<constructor-arg name="dnsApiUrl" value="${dns.config.api.url}" />
	</bean>

	<bean id="sheduletask" class="com.monitor.other.task.SheduleTask">
		<property name="taskScheduler" ref="scheduler" />
	</bean>



	<!-- redis template definition -->
	<bean id="stringRedisSerializer"
		class="org.springframework.data.redis.serializer.StringRedisSerializer" />

	<!-- pool config -->
	<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
		<property name="maxTotal" value="${redis.pool.maxTotal:50}" />
		<property name="maxIdle" value="${redis.pool.maxIdle:10}" />
		<property name="minIdle" value="${redis.pool.minIdle:5}" />
		<property name="maxWaitMillis" value="${redis.pool.maxWaitMillis:2000}" />
		<property name="testOnBorrow" value="${redis.pool.testOnBorrow:false}" />
		<property name="testWhileIdle" value="${redis.pool.testWhileIdle:false}" />
	</bean>


		<!-- 配置RestTemplate -->
    <!--Http client Factory-->
    <bean id="httpClientFactory" class="org.springframework.http.client.SimpleClientHttpRequestFactory">
        <property name="connectTimeout" value="${connectTimeout}" />
        <property name="readTimeout" value="${readTimeout}" />
    </bean>

    <!--RestTemplate-->
    <bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
        <constructor-arg ref="httpClientFactory" />
        <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>
                            <value>application/json;charset=UTF-8</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>
    <!-- 配置RestTemplate -->
</beans>