У меня есть зависимость
Код: Выделить всё
org.springframework.boot
spring-boot-starter-data-redis-reactive
и у меня есть следующий класс конфигурации:
Код: Выделить всё
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory;
import org.springframework.data.redis.core.ReactiveRedisTemplate;
import org.springframework.data.redis.serializer.GenericToStringSerializer;
import org.springframework.data.redis.serializer.RedisSerializationContext;
import org.springframework.data.redis.serializer.StringRedisSerializer;
@Configuration
public class RedisConfig {
@Bean
public ReactiveRedisTemplate redisTemplate(ReactiveRedisConnectionFactory reactiveRedisConnectionFactory) {
RedisSerializationContext serializationContext = RedisSerializationContext
.newSerializationContext(new StringRedisSerializer())
.value(new GenericToStringSerializer(Integer.class))
.build();
return new ReactiveRedisTemplate(reactiveRedisConnectionFactory, serializationContext);
}
}
Код: Выделить всё
2024-10-16 14:24:51 org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'redisReferenceResolver': Unsatisfied dependency expressed through constructor parameter 0:
Could not convert argument value of type [org.springframework.data.redis.core.ReactiveRedisTemplate] to required type [org.springframework.data.redis.core.RedisOperations]:
Failed to convert value of type 'org.springframework.data.redis.core.ReactiveRedisTemplate' to required type 'org.springframework.data.redis.core.RedisOperations';
nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.data.redis.core.ReactiveRedisTemplate' to required type 'org.springframework.data.redis.core.RedisOperations': no matching editors or conversion strategy found
Подробнее здесь: https://stackoverflow.com/questions/790 ... iverediste