似乎spring-data-jdbc和session redis无法协同工作,至少在没有任何附加配置的情况下是如此。
我是不是遗漏了什么?
以下是我的错误:
.RepositoryConfigurationExtensionSupport : Spring Data JDBC - Could not safely identify store assignment for repository candidate interface ca.code3.timekeeper.repository.ClientRepository. If you want this repository to be a JDBC repository, consider annotating your entities with one of these annotations: org.springframework.data.relational.core.mapping.Table.仅使用spring数据-jdbc就像一种魅力。
发布于 2020-09-23 09:45:39
spring-session-data-redis依赖项引入了spring-data-redis依赖项。
由于您还使用了spring-data-jdbc,所以Spring数据需要一种方法来区分应该使用哪种持久性技术。
由于应用程序具有多个Spring数据模块,因此Spring数据进入严格的存储库配置模式。
您应该在日志中看到以下消息
找到多个Spring数据模块,进入严格的存储库配置模式!
这意味着Spring数据将查找存储库或域类的详细信息,以决定Spring数据模块绑定。
在本例中,由于您希望在域类中使用JDBC,所以应该使用@Table对其进行注释。
例如:
interface PersonRepository extends CrudRepository<Person, Long> { … }
@Table
class Person { … }有一节介绍如何在参考文献中使用多个Spring数据模块的存储库。
https://stackoverflow.com/questions/63966238
复制相似问题