|
|
@ -16,8 +16,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.boot.autoconfigure.data.redis;
|
|
|
|
package org.springframework.boot.autoconfigure.data.redis;
|
|
|
|
|
|
|
|
|
|
|
|
import java.net.UnknownHostException;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
|
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
|
@ -54,8 +52,7 @@ public class RedisAutoConfiguration {
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
@ConditionalOnMissingBean(name = "redisTemplate")
|
|
|
|
@ConditionalOnMissingBean(name = "redisTemplate")
|
|
|
|
@ConditionalOnSingleCandidate(RedisConnectionFactory.class)
|
|
|
|
@ConditionalOnSingleCandidate(RedisConnectionFactory.class)
|
|
|
|
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory)
|
|
|
|
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
|
|
|
throws UnknownHostException {
|
|
|
|
|
|
|
|
RedisTemplate<Object, Object> template = new RedisTemplate<>();
|
|
|
|
RedisTemplate<Object, Object> template = new RedisTemplate<>();
|
|
|
|
template.setConnectionFactory(redisConnectionFactory);
|
|
|
|
template.setConnectionFactory(redisConnectionFactory);
|
|
|
|
return template;
|
|
|
|
return template;
|
|
|
@ -64,8 +61,7 @@ public class RedisAutoConfiguration {
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
@ConditionalOnMissingBean
|
|
|
|
@ConditionalOnMissingBean
|
|
|
|
@ConditionalOnSingleCandidate(RedisConnectionFactory.class)
|
|
|
|
@ConditionalOnSingleCandidate(RedisConnectionFactory.class)
|
|
|
|
public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory redisConnectionFactory)
|
|
|
|
public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
|
|
|
throws UnknownHostException {
|
|
|
|
|
|
|
|
StringRedisTemplate template = new StringRedisTemplate();
|
|
|
|
StringRedisTemplate template = new StringRedisTemplate();
|
|
|
|
template.setConnectionFactory(redisConnectionFactory);
|
|
|
|
template.setConnectionFactory(redisConnectionFactory);
|
|
|
|
return template;
|
|
|
|
return template;
|
|
|
|