Daniel - Managing the library dependencies is not as smooth as that. A full reference iplementation/sample project would be very helpful.
org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.RedisConnectionFactory]: Factory method 'connectionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: com/lambdaworks/redis/RedisException
--- gradle build ----
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-redis'
compile group: 'com.lambdaworks', name: 'lettuce' , version: '2.3.3'
compile group: 'io.lettuce', name: 'lettuce-core', version: '5.0.0.RELEASE'
compile 'redis.clients:jedis'
--- config class --
@Bean
public PdfLocationRepositoryCustom pdfLocationRepositoryImpl(){
return new PdfLocationRedisRepositoryImpl(redisTemplate());
}
@Bean
public RedisConnectionFactory connectionFactory() {
return new LettuceConnectionFactory(getRedisClusterConfiguration());
//return new JedisConnectionFactory(getRedisClusterConfiguration());
}
@Bean
public RedisClusterConfiguration getRedisClusterConfiguration() {
Map<String, Object> source = Maps.newHashMap();
source.put("spring.redis.cluster.nodes", "ds1-redic-poc.redis.cache.windows.net:6380");
source.put("spring.redis.cluster.timeout", "30");
//source.put("spring.redis.cluster.max", ?);
source.put("spring.redis.cluster.password", "xxxxxx");
//source.put("spring.redis.cluster.max-redirects", ?);
return new RedisClusterConfiguration(new MapPropertySource("RedisClusterConfiguration", source));
}
@Bean
public RedisTemplate<String, Object> redisTemplate() {
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(connectionFactory());
template.setKeySerializer(new StringRedisSerializer());
template.setHashValueSerializer(new GenericToStringSerializer<>( Object.class ));
return template;
}