use of org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory in project pivotal-cla by pivotalsoftware.
the class SessionConfig method cloudRedisConnectionFactory.
@Profile(GitHubClaProfiles.CLOUDFOUNDRY)
@Bean
public RedisConnectionFactory cloudRedisConnectionFactory() {
CloudFactory cloudFactory = new CloudFactory();
Cloud cloud = cloudFactory.getCloud();
RedisConnectionFactory connectionFactory = cloud.getSingletonServiceConnector(RedisConnectionFactory.class, null);
if (connectionFactory instanceof LettuceConnectionFactory) {
((LettuceConnectionFactory) connectionFactory).setShutdownTimeout(0);
}
return connectionFactory;
}
use of org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory in project spring-session by spring-projects.
the class IndexDocTests method newReactiveRedisOperationsSessionRepository.
@Test
@SuppressWarnings("unused")
public void newReactiveRedisOperationsSessionRepository() {
LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory();
RedisSerializationContext<String, Object> serializationContext = RedisSerializationContext.<String, Object>newSerializationContext(new JdkSerializationRedisSerializer()).build();
// tag::new-reactiveredisoperationssessionrepository[]
// ... create and configure connectionFactory and serializationContext ...
ReactiveRedisTemplate<String, Object> redisTemplate = new ReactiveRedisTemplate<>(connectionFactory, serializationContext);
ReactiveSessionRepository<? extends Session> repository = new ReactiveRedisOperationsSessionRepository(redisTemplate);
// end::new-reactiveredisoperationssessionrepository[]
}
use of org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory in project spring-cloud-connectors by spring-cloud.
the class RedisServiceConnectorCreatorTest method assertConnectorProperties.
private void assertConnectorProperties(RedisServiceInfo serviceInfo, RedisConnectionFactory connector, boolean isSecure) {
assertNotNull(connector);
if (connector instanceof JedisConnectionFactory) {
JedisConnectionFactory connectionFactory = (JedisConnectionFactory) connector;
assertEquals(serviceInfo.getHost(), connectionFactory.getHostName());
assertEquals(serviceInfo.getPort(), connectionFactory.getPort());
assertEquals(serviceInfo.getPassword(), connectionFactory.getPassword());
assertEquals(isSecure, connectionFactory.isUseSsl());
} else if (connector instanceof LettuceConnectionFactory) {
LettuceConnectionFactory connectionFactory = (LettuceConnectionFactory) connector;
assertEquals(serviceInfo.getHost(), connectionFactory.getHostName());
assertEquals(serviceInfo.getPort(), connectionFactory.getPort());
assertEquals(serviceInfo.getPassword(), connectionFactory.getPassword());
assertEquals(isSecure, connectionFactory.isUseSsl());
} else {
fail("Expected RedisConnectionFactory of type " + JedisConnectionFactory.class.getName() + " or " + LettuceConnectionFactory.class.getName() + " but was of type " + connector.getClass().getName());
}
}
use of org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory in project spring-cloud-connectors by spring-cloud.
the class SpringData1RedisServiceConnectorCreatorTest method assertConnectorProperties.
private void assertConnectorProperties(RedisServiceInfo serviceInfo, RedisConnectionFactory connector) {
assertNotNull(connector);
if (connector instanceof JedisConnectionFactory) {
JedisConnectionFactory connectionFactory = (JedisConnectionFactory) connector;
assertEquals(serviceInfo.getHost(), connectionFactory.getHostName());
assertEquals(serviceInfo.getPort(), connectionFactory.getPort());
assertEquals(serviceInfo.getPassword(), connectionFactory.getPassword());
} else if (connector instanceof LettuceConnectionFactory) {
LettuceConnectionFactory connectionFactory = (LettuceConnectionFactory) connector;
assertEquals(serviceInfo.getHost(), connectionFactory.getHostName());
assertEquals(serviceInfo.getPort(), connectionFactory.getPort());
assertEquals(serviceInfo.getPassword(), connectionFactory.getPassword());
} else {
fail("Expected RedisConnectionFactory of type " + JedisConnectionFactory.class.getName() + " or " + LettuceConnectionFactory.class.getName() + " but was of type " + connector.getClass().getName());
}
}
use of org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory in project spring-boot by spring-projects.
the class RedisAutoConfigurationTests method testRedisConfigurationWithCustomBean.
@Test
void testRedisConfigurationWithCustomBean() {
this.contextRunner.withUserConfiguration(RedisStandaloneConfig.class).run((context) -> {
LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo");
});
}
Aggregations