7

我正在尝试在一个项目中使用@EnableRedisRepositoriesand@EnableMapRepositories我收到以下错误消息:

相关原因:org.springframework.beans.factory.UnsatisfiedDependencyException:创建名为'redisConverter'的bean时出错:通过构造函数参数0表示的不满足依赖关系:无法转换类型[org.springframework.data.keyvalue.core.mapping. context.KeyValueMappingContext] 到所需类型 [org.springframework.data.redis.core.mapping.RedisMappingContext]:无法将类型 'org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext' 的值转换为所需类型' org.springframework.data.redis.core.mapping.RedisMappingContext'; 嵌套异常是 java.lang.IllegalStateException:无法将类型 'org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext' 的值转换为所需的类型 'org.

那么是否可以在同一个项目中同时使用两者?

4

1 回答 1

3

存在已知问题https://jira.spring.io/browse/DATAREDIS-846

作为一种解决方法,您可以禁用存储库自动配置:

spring.data.redis.repositories.enabled=false

并添加

@EnableRedisRepositories(basePackages="org.my.redis.repositories")

反而。

于 2020-01-22T23:32:06.617 回答