【问题标题】:How to assign Spring Data LDAP repository to a specific connection (LDAPTemplate)?如何将 Spring Data LDAP 存储库分配给特定连接(LDAPTemplate)?
【发布时间】:2019-04-09 18:38:03
【问题描述】:

我有一个这样的 Spring Data LDAP 存储库:

package x.y.z.repository;

import org.springframework.data.ldap.repository.LdapRepository;
import org.springframework.stereotype.Repository;

import x.y.z.domain.User;

@Repository
public interface UserRepository extends LdapRepository<User>{
    User findByUserId(String userId);
}

不幸的是,我在 spring 上下文中有多个 LDAP 连接。如何定义哪个LDAPTemplate 属于哪个Repository?我在documentation 中没有找到任何内容。

【问题讨论】:

  • 嗯。提到了 ldap-template-ref,但是我无法真正找到要定义它的位置。它似乎是一个 XML 配置条目。 Java配置有可能吗?

标签: java ldap spring-data spring-ldap


【解决方案1】:

所以我想通了。在EnableLdapRepositories 注解中可以定义template reference

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-02-04
    • 2022-10-21
    • 1970-01-01
    • 2017-11-14
    • 2016-03-06
    • 2020-06-01
    • 2014-06-19
    相关资源
    最近更新 更多