skip to Main Content

using spring boot data redis template get a null pointer error

config: @Configuration @EnableCaching public class RedisConfig extends CachingConfigurerSupport{ @Bean(name = "template") public RedisTemplate<String, Object> template(RedisConnectionFactory factory) { RedisTemplate<String, Object> template = new RedisTemplate<>(); template.setConnectionFactory(factory); Jackson2JsonRedisSerializer<Object> jacksonSeial = new Jackson2JsonRedisSerializer<>(Object.class); ObjectMapper om = new ObjectMapper(); om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); jacksonSeial.setObjectMapper(om); StringRedisSerializer stringSerial…

VIEW QUESTION

Spring Boot Caching with Redis Sentinel always connects to master node

I have a Spring Boot (2.3.1.RELEASE) app that has caching with Redis Sentinel. This is my configuration for the Sentinel connection: @Bean public LettuceConnectionFactory redisConnectionFactory() { RedisSentinelConfiguration sentinelConfig = new RedisSentinelConfiguration() .master(redisProperties.getSentinel().getMaster()); redisProperties.getSentinel().getNodes().forEach(s -> sentinelConfig.sentinel(s, redisProperties.getPort())); sentinelConfig.setPassword(RedisPassword.of(redisProperties.getPassword())); return new LettuceConnectionFactory(sentinelConfig);…

VIEW QUESTION

Error invoking scheduled task Error instantiating bean of type [io.micronaut.configuration.lettuce.health.RedisHealthIndicator]

I have the following problem when running this schedule. @Singleton public class TaskScheduler { private static final Logger LOG = LoggerFactory.getLogger(TaskScheduler.class); @Inject private BuildLayerJob buildLayerJob; @Scheduled(fixedDelay = "30s", initialDelay = "30s") public void loadRegistriesDescriptions(){ try { LOG.info("Cargando lista de registries…

VIEW QUESTION

Set connection parameters in RedisConnectionFactory

I have simple Redis client based on Spring below. As default it connects to local host, but I need to set different host and port. I suppose I can do it in function below: @Bean RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory,MessageListenerAdapter listenerAdapter) {…

VIEW QUESTION

org.springframework.data.redis.RedisConnectionFailureException: Could not get a resource from the pool – Debian

My cassandra docker-compose file: version: '2' services: redis-node-0: image: docker.io/bitnami/redis-cluster:latest ports: - "6370:6379" environment: - 'REDIS_PASSWORD=pass' - 'REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5' redis-node-1: image: docker.io/bitnami/redis-cluster:latest ports: - "6371:6379" environment: - 'REDIS_PASSWORD=pass' - 'REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5' redis-node-2:…

VIEW QUESTION
Back To Top
Search