首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用spring-data-jdbc和spring-session-redis

使用spring-data-jdbc和spring-session-redis
EN

Stack Overflow用户
提问于 2020-09-19 07:11:04
回答 1查看 1.3K关注 0票数 1

似乎spring-data-jdbc和session redis无法协同工作,至少在没有任何附加配置的情况下是如此。

我是不是遗漏了什么?

以下是我的错误:

代码语言:javascript
复制
.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就像一种魅力。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-09-23 09:45:39

spring-session-data-redis依赖项引入了spring-data-redis依赖项。

由于您还使用了spring-data-jdbc,所以Spring数据需要一种方法来区分应该使用哪种持久性技术。

由于应用程序具有多个Spring数据模块,因此Spring数据进入严格的存储库配置模式。

您应该在日志中看到以下消息

找到多个Spring数据模块,进入严格的存储库配置模式!

这意味着Spring数据将查找存储库或域类的详细信息,以决定Spring数据模块绑定。

在本例中,由于您希望在域类中使用JDBC,所以应该使用@Table对其进行注释。

例如:

代码语言:javascript
复制
interface PersonRepository extends CrudRepository<Person, Long> { … }

@Table
class Person { … }

有一节介绍如何在参考文献中使用多个Spring数据模块的存储库。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63966238

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档