<?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:int="http://www.springframework.org/schema/integration"
	xmlns:int-redis="http://www.springframework.org/schema/integration/redis"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd
		http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd
		http://www.springframework.org/schema/integration/redis https://www.springframework.org/schema/integration/redis/spring-integration-redis.xsd
		http://www.springframework.org/schema/tx https://www.springframework.org/schema/tx/spring-tx.xsd
		http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">

	<context:property-placeholder properties-ref="props" />

	<util:properties id="props">
		<prop key="collection.type">PROPERTIES</prop>
	</util:properties>

	<int-redis:store-outbound-channel-adapter id="withStringTemplate"
											  collection-type="${collection.type}"
											  key="pepboys"
											  zset-increment-expression="true"
											  auto-startup="false">
		<int-redis:request-handler-advice-chain>
			<int:retry-advice/>
		</int-redis:request-handler-advice-chain>
	</int-redis:store-outbound-channel-adapter>

	<int-redis:store-outbound-channel-adapter id="withStringObjectTemplate"
											  collection-type="PROPERTIES"
											  key="pepboys"
											  extract-payload-elements="false"
											  auto-startup="false"/>

	<bean id="keySerializer" class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
	<bean id="valueSerializer" class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer"/>
	<bean id="hashKeySerializer" class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer"/>
	<bean id="hashValueSerializer" class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer"/>

	<bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
		<property name="connectionFactory" ref="redisConnectionFactory"/>
		<property name="keySerializer" ref="keySerializer"/>
		<property name="valueSerializer" ref="valueSerializer"/>
		<property name="hashKeySerializer" ref="hashKeySerializer"/>
		<property name="hashValueSerializer" ref="hashValueSerializer"/>
	</bean>

	<bean id="redisConnectionFactory" class="org.mockito.Mockito" factory-method="mock">
		<constructor-arg value="org.springframework.data.redis.connection.RedisConnectionFactory" type="java.lang.Class"/>
	</bean>

	<int-redis:store-outbound-channel-adapter id="withExternalTemplate"
											  collection-type="PROPERTIES"
											  key="pepboys"
											  redis-template="redisTemplate"
											  auto-startup="false"/>

</beans>
