spring-info.xml 7.24 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>

<!--	<bean id="maliciousIpJob" class="com.monitor.other.maliciousip.job.MaliciousIpJob"
		init-method="init">
	</bean>-->

	<bean id="redisReadUtil" class="com.monitor.other.maliciousip.util.RedisReadUtil" />

	<bean id="redisWriteUtil" class="com.monitor.other.maliciousip.util.RedisWriteUtil" />

	<bean id="redisReadMaliciousUtil"
		class="com.monitor.other.maliciousip.util.RedisReadMaliciousUtil" />

	<!-- 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>

	<!-- aws 1 -->
	<bean id="aws1JedisWriteConnectionFactory"
		class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
		p:timeout="250" p:poolConfig-ref="jedisPoolConfig"
		p:hostName="${malicious.ip.redis.write.aws.host1}" p:port="${malicious.ip.redis.write.port}"
		p:password="${aws.redis.proxy.auth}" p:database="${aws.redis.proxy.database:0}"
		primary="true" />
	<bean id="aws1RedisWriteTemplate" primary="false"
		class="org.springframework.data.redis.core.RedisTemplate"
		p:connectionFactory-ref="aws1JedisWriteConnectionFactory"
		p:keySerializer-ref="stringRedisSerializer" p:valueSerializer-ref="stringRedisSerializer"
		p:hashKeySerializer-ref="stringRedisSerializer"
		p:hashValueSerializer-ref="stringRedisSerializer" />

	<!-- aws 2 -->
	<bean id="aws2JedisWriteConnectionFactory"
		class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
		p:timeout="250" p:poolConfig-ref="jedisPoolConfig"
		p:hostName="${malicious.ip.redis.write.aws.host2}" p:port="${malicious.ip.redis.write.port}"
		p:password="${aws.redis.proxy.auth}" p:database="${aws.redis.proxy.database:0}"
		primary="true" />
	<bean id="aws2RedisWriteTemplate" primary="false"
		class="org.springframework.data.redis.core.RedisTemplate"
		p:connectionFactory-ref="aws2JedisWriteConnectionFactory"
		p:keySerializer-ref="stringRedisSerializer" p:valueSerializer-ref="stringRedisSerializer"
		p:hashKeySerializer-ref="stringRedisSerializer"
		p:hashValueSerializer-ref="stringRedisSerializer" />

	<!-- qq 1 -->
	<bean id="qq1JedisWriteConnectionFactory"
		class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
		p:timeout="250" p:poolConfig-ref="jedisPoolConfig"
		p:hostName="${malicious.ip.redis.write.qq.host1}" p:port="${malicious.ip.redis.write.port}"
		p:password="${aws.redis.proxy.auth}" p:database="${aws.redis.proxy.database:0}"
		primary="true" />
	<bean id="qq1RedisWriteTemplate" primary="false"
		class="org.springframework.data.redis.core.RedisTemplate"
		p:connectionFactory-ref="qq1JedisWriteConnectionFactory"
		p:keySerializer-ref="stringRedisSerializer" p:valueSerializer-ref="stringRedisSerializer"
		p:hashKeySerializer-ref="stringRedisSerializer"
		p:hashValueSerializer-ref="stringRedisSerializer" />

	<!-- qq 2 -->
	<bean id="qq2JedisWriteConnectionFactory"
		class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
		p:timeout="250" p:poolConfig-ref="jedisPoolConfig"
		p:hostName="${malicious.ip.redis.write.qq.host2}" p:port="${malicious.ip.redis.write.port}"
		p:password="${aws.redis.proxy.auth}" p:database="${aws.redis.proxy.database:0}"
		primary="true" />
	<bean id="qq2RedisWriteTemplate" primary="false"
		class="org.springframework.data.redis.core.RedisTemplate"
		p:connectionFactory-ref="qq2JedisWriteConnectionFactory"
		p:keySerializer-ref="stringRedisSerializer" p:valueSerializer-ref="stringRedisSerializer"
		p:hashKeySerializer-ref="stringRedisSerializer"
		p:hashValueSerializer-ref="stringRedisSerializer" />

	<!-- spark read -->
	<bean id="jedisReaderConnectionFactory"
		class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
		p:timeout="250" p:poolConfig-ref="jedisPoolConfig" p:hostName="${malicious.ip.redis.read.host}"
		p:port="${malicious.ip.redis.read.port}" p:password="${aws.redis.proxy.auth}"
		p:database="${aws.redis.proxy.database:0}" primary="true" />
	<bean id="redisReaderTemplate" primary="false"
		class="org.springframework.data.redis.core.StringRedisTemplate"
		p:connectionFactory-ref="jedisReaderConnectionFactory"
		p:keySerializer-ref="stringRedisSerializer" p:valueSerializer-ref="stringRedisSerializer"
		p:hashKeySerializer-ref="stringRedisSerializer"
		p:hashValueSerializer-ref="stringRedisSerializer" />
		
		<!-- 配置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>