pull/23540/head
Stephane Nicoll 4 years ago
parent 5553926267
commit a5c20a5132

@ -16,8 +16,6 @@
package org.springframework.boot.autoconfigure.data.redis; package org.springframework.boot.autoconfigure.data.redis;
import java.net.UnknownHostException;
import org.apache.commons.pool2.impl.GenericObjectPool; import org.apache.commons.pool2.impl.GenericObjectPool;
import redis.clients.jedis.Jedis; import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPoolConfig; import redis.clients.jedis.JedisPoolConfig;
@ -58,7 +56,7 @@ class JedisConnectionConfiguration extends RedisConnectionConfiguration {
@Bean @Bean
JedisConnectionFactory redisConnectionFactory( JedisConnectionFactory redisConnectionFactory(
ObjectProvider<JedisClientConfigurationBuilderCustomizer> builderCustomizers) throws UnknownHostException { ObjectProvider<JedisClientConfigurationBuilderCustomizer> builderCustomizers) {
return createJedisConnectionFactory(builderCustomizers); return createJedisConnectionFactory(builderCustomizers);
} }

@ -16,7 +16,6 @@
package org.springframework.boot.autoconfigure.data.redis; package org.springframework.boot.autoconfigure.data.redis;
import java.net.UnknownHostException;
import java.time.Duration; import java.time.Duration;
import io.lettuce.core.ClientOptions; import io.lettuce.core.ClientOptions;
@ -74,7 +73,7 @@ class LettuceConnectionConfiguration extends RedisConnectionConfiguration {
@ConditionalOnMissingBean(RedisConnectionFactory.class) @ConditionalOnMissingBean(RedisConnectionFactory.class)
LettuceConnectionFactory redisConnectionFactory( LettuceConnectionFactory redisConnectionFactory(
ObjectProvider<LettuceClientConfigurationBuilderCustomizer> builderCustomizers, ObjectProvider<LettuceClientConfigurationBuilderCustomizer> builderCustomizers,
ClientResources clientResources) throws UnknownHostException { ClientResources clientResources) {
LettuceClientConfiguration clientConfig = getLettuceClientConfiguration(builderCustomizers, clientResources, LettuceClientConfiguration clientConfig = getLettuceClientConfiguration(builderCustomizers, clientResources,
getProperties().getLettuce().getPool()); getProperties().getLettuce().getPool());
return createLettuceConnectionFactory(clientConfig); return createLettuceConnectionFactory(clientConfig);

@ -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;

Loading…
Cancel
Save