【问题标题】:Does Spring LDAP (Spring Data Repository) support repository customization?Spring LDAP(Spring Data Repository)是否支持存储库定制?
【发布时间】:2017-12-12 19:07:34
【问题描述】:

我正在使用 Spring LDAP 2.3.1 并希望通过添加我自己的 create 方法来自定义我的存储库。我希望我可以使用 Spring Data Commons 文档第 2.6 节中描述的功能,但它似乎不起作用。

这个功能是为 Spring LDAP 实现的吗?

【问题讨论】:

标签: spring-data spring-ldap


【解决方案1】:

不确定你自己的创建方法是什么意思。每个 Spring Data 模块都可以使用自定义存储库实现,请参阅reference docs。

【讨论】:

  • 你用 Spring Ldap 试过这个吗?我完全按照这些文档中的示例进行操作,并得到了我的自定义创建方法未找到的错误。也许我做错了什么。我只是想确认是否真的为 Spring Ldap 实现了自定义。
  • 这里有一些示例代码:github.com/spring-projects/spring-data-ldap/blob/master/src/…。愿意发布您的(最小)代码示例吗?
  • 非常感谢。我会尝试,如果失败,我会发布代码和错误。
  • 我有这个基于那个例子的工作,但我还有一个问题。我为特定类型创建了 CustomizedRepo 和 CustomizedRepoImpl。我只希望 impl 适用于那一种类型。为了让它工作,我必须包含指向我的 impl 类的 @EnableLdapRepositories(considerNestedRepositories = true, repositoryBaseClass = CustomizedLdapRepositoryImpl.class)。那么如何为不同类型创建另一个扩展存储库?我想我需要以某种方式表明它将使用不同的 repositoryBaseClass?
  • 为了澄清该评论,来自 mp911de 的示例是自定义基础 repo。我想为一种类型的 ldap 对象定制一个 repo。在同一个项目的 spring-data-ldap 中有一个例子。测试类是 CdiExtensionIntegrationTests。如果我尝试运行测试,我会收到编译错误。我不知道是我遗漏了什么还是有错误。
猜你喜欢
  • 2017-12-27
  • 2018-01-01
  • 2019-12-06
  • 2017-05-06
  • 2016-03-25
  • 2017-06-16
  • 2015-03-01
  • 2018-06-20
  • 1970-01-01
相关资源
最近更新 更多