JedisConnectionFactory setHostName is deprecated

With Spring Data Redis 2.0, those methods have been deprecated.
You now need to configure using RedisStandaloneConfiguration

Reference: https://docs.spring.io/spring-data/redis/docs/current/api/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.html#setHostName-java.lang.String-

Example:

JedisConnectionFactory jedisConnectionFactory() {
    RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration("localhost", 6379);
    redisStandaloneConfiguration.setPassword(RedisPassword.of("yourRedisPasswordIfAny"));
    return new JedisConnectionFactory(redisStandaloneConfiguration);
}

Leave a Comment

tech