I'm trying to use @EnableRedisRepositories
and @EnableMapRepositories
in a project and I'm getting the following error message:
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisConverter': Unsatisfied dependency expressed through constructor parameter 0: Could not convert argument value of type [org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext] to required type [org.springframework.data.redis.core.mapping.RedisMappingContext]: Failed to convert value of type 'org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext' to required type 'org.springframework.data.redis.core.mapping.RedisMappingContext'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext' to required type 'org.springframework.data.redis.core.mapping.RedisMappingContext': no matching editors or conversion strategy found
So is it possible to use both in the same project?
public class ReactiveRedisTemplate<K,V> extends Object implements ReactiveRedisOperations<K,V> Central abstraction for reactive Redis data access implementing ReactiveRedisOperations . Performs automatic serialization/deserialization between the given objects and the underlying binary data in the Redis store.
Once established, RedisTemplate becomes the main abstraction of Redis' operations that we can command. It also takes care of serialization and deserialization of objects to byte arrays. By default, RedisTemplate uses the JdkSerializationRedisSerializer to serialize and deserialize objects.
public class StringRedisTemplate extends RedisTemplate<String,String> String-focused extension of RedisTemplate. Since most operations against Redis are String based, this class provides a dedicated class that minimizes configuration of its more generic template especially in terms of serializers.
There is known issue https://jira.spring.io/browse/DATAREDIS-846.
As a workaround you may disable repository auto configuration:
spring.data.redis.repositories.enabled=false
And add
@EnableRedisRepositories(basePackages="org.my.redis.repositories")
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With