2016-07-28 71 views
0

我想从ldap中使用spring-ldap读取值。如何从ldap中使用spring-ldap读取值

我试图按照基于文档 http://docs.spring.io/spring-ldap/docs/current/reference/#basic-queries

我的程序无法编译,因为LdapQuery找不到LDAP查询。

LdapQuery query = query() 
     .base("dc=261consulting,dc=com") 
     .attributes("cn", "sn") 
     .where("objectclass").is("person") 
     .and("sn").is(lastName); 

我的pom.xml包含以下条目。

<dependency> 
    <groupId>org.springframework.ldap</groupId> 
    <artifactId>spring-ldap-core</artifactId> 
    <version>1.3.1.RELEASE</version> 
</dependency> 

我看着弹簧LDAP API文档在http://docs.spring.io/spring-ldap/site/apidocs/index.html,他们好像还没有LdapQuery类。

请问如何从spring中使用ldap读取值?如果你能提供一个例子,那会很好。

谢谢

回答

1

LdapQuery添加了2.0。如果您受限于早期版本,请考虑使用LdapTemplate。

+0

谢谢。我猜文档没有更新。 LdapTemplate适合我。 – kevin

+0

您应该使用当前的API文档:http://docs.spring.io/spring-ldap/docs/2.1.0.RELEASE/reference/ – marthursson

相关问题