如何将 Spring Data LDAP 存储库分配给特定连接 (LDAPTemplate)



我有一个像这样的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);
}

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

所以我想通了。在 EnableLdapRepository 注释中,可以定义模板引用。

最新更新