Spring LDAP Repositories
Spring LDAP 具有对 Spring Data 存储库的内置支持。基本功能和配置在 here 中进行了说明。在使用 Spring LDAP 存储库时,请记住:
Spring LDAP has built-in support for Spring Data repositories. The basic functionality and configuration is described here. When working with Spring LDAP repositories, you should remember the following:
-
你可以通过在 XML 配置中使用一个 `<ldap:repositories>`元素或通过在配置类中使用一个 `@EnableLdapRepositories`注解来启用 Spring LDAP 存储库。
-
You can enable Spring LDAP repositories by using an
<ldap:repositories>
element in your XML configuration or by using an@EnableLdapRepositories
annotation on a configuration class. -
要为自动生成的仓库包含对
LdapQuery
参数的支持,让你的界面扩展LdapRepository
而非CrudRepository
。 -
To include support for
LdapQuery
parameters in automatically generated repositories, have your interface extendLdapRepository
rather thanCrudRepository
. -
所有 Spring LDAP 存储库都必须与用 ODM 注解注解的实体一起使用,如 Object-Directory Mapping (ODM)所述。
-
All Spring LDAP repositories must work with entities that are annotated with the ODM annotations, as described in Object-Directory Mapping (ODM).
-
由于所有 ODM 托管类必须将特有名作为 ID,所以所有 Spring LDAP 存储库必须将 ID 类型参数设置为
javax.naming.Name
。内置LdapRepository`只接受一个类型参数:托管实体类,ID 默认值为 `javax.naming.Name
。 -
Since all ODM managed classes must have a Distinguished Name as the ID, all Spring LDAP repositories must have the ID type parameter set to
javax.naming.Name
. The built-inLdapRepository
takes only one type parameter: the managed entity class, defaulting the ID tojavax.naming.Name
. -
由于 LDAP 协议的具体特性,无法支持 Spring LDAP 存储库的分页和排序。
-
Due to specifics of the LDAP protocol, paging and sorting are not supported for Spring LDAP repositories.
QueryDSL support
基本 QueryDSL 支持包含在 Spring LDAP 中。此支持包括以下内容:
Basic QueryDSL support is included in Spring LDAP. This support includes the following:
-
一个名为 `LdapAnnotationProcessor`的注解处理器用于根据 Spring LDAP ODM 注解生成 QueryDSL 类。查看 Object-Directory Mapping (ODM)来获取有关 ODM 注解的更多信息。
-
An annotation processor, called
LdapAnnotationProcessor
, for generating QueryDSL classes based on Spring LDAP ODM annotations. See Object-Directory Mapping (ODM) for more information on the ODM annotations. -
一个名为 `QueryDslLdapQuery`的查询实现,用于构建并运行代码中的 QueryDSL 查询。
-
A Query implementation, called
QueryDslLdapQuery
, for building and running QueryDSL queries in code. -
Spring Data 存储库对 QueryDSL 谓词支持。`QueryDslPredicateExecutor`包含许多带有适当参数的其他方法。你可以将这个接口与 `LdapRepository`一起扩展,以便在你的存储库中包含这个支持。
-
Spring Data repository support for QueryDSL predicates.
QueryDslPredicateExecutor
includes a number of additional methods with appropriate parameters. You can extend this interface along withLdapRepository
to include this support in your repository.