use of org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration in project dhis2-core by dhis2.
the class RedisConfiguration method lettuceConnectionFactory.
@Bean
public LettuceConnectionFactory lettuceConnectionFactory() {
LettuceClientConfigurationBuilder builder = LettuceClientConfiguration.builder();
if (DhisConfigurationProvider.isOn((String) redisSslEnabled().getObject())) {
builder.useSsl();
}
LettuceClientConfiguration clientConfiguration = builder.build();
RedisStandaloneConfiguration standaloneConfig = new RedisStandaloneConfiguration();
standaloneConfig.setHostName((String) redisHost().getObject());
standaloneConfig.setPassword((String) redisPassword().getObject());
standaloneConfig.setPort(Integer.parseInt((String) redisPort().getObject()));
return new LettuceConnectionFactory(standaloneConfig, clientConfiguration);
}
use of org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration in project spring-cloud-connectors by spring-cloud.
the class RedisConnectionFactoryCloudConfigTestHelper method assertPoolProperties.
public static void assertPoolProperties(RedisConnectionFactory connector, int maxActive, int minIdle, long maxWait) {
GenericObjectPoolConfig poolConfig = null;
if (connector instanceof JedisConnectionFactory) {
poolConfig = ((JedisConnectionFactory) connector).getPoolConfig();
} else if (connector instanceof LettuceConnectionFactory) {
LettuceClientConfiguration config = ((LettuceConnectionFactory) connector).getClientConfiguration();
assertThat(config, instanceOf(LettucePoolingClientConfiguration.class));
poolConfig = ((LettucePoolingClientConfiguration) config).getPoolConfig();
}
assertCommonsPoolProperties(poolConfig, maxActive, minIdle, maxWait);
}
Aggregations