I know this question has been asked in stack overflow before, however the solutions given did not work for me.
I get the following error:
Error creating bean with name 'jedisConnectionFactory' defined in class path resource
Here is the class that contains the Bean
@Configuration@EnableRedisRepositoriespublic class RedisConfig { @Bean JedisConnectionFactory jedisConnectionFactory() { RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration(); redisStandaloneConfiguration.setHostName("localhost"); redisStandaloneConfiguration.setPort(6379); redisStandaloneConfiguration.setDatabase(0); redisStandaloneConfiguration.setPassword(RedisPassword.of("password")); JedisClientConfiguration.JedisClientConfigurationBuilder jedisClientConfiguration = JedisClientConfiguration.builder(); jedisClientConfiguration.connectTimeout(Duration.ofSeconds(60));// 60s connection timeout JedisConnectionFactory jedisConFactory = new JedisConnectionFactory(redisStandaloneConfiguration, jedisClientConfiguration.build()); return jedisConFactory; } @Bean public RedisTemplate<String, Object> redisTemplate() { RedisTemplate<String, Object> template = new RedisTemplate<>(); template.setConnectionFactory(jedisConnectionFactory()); return template; }}
And this is my import, which should contain Jedis
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId><version>2.6.2</version></dependency>