Hi,
Lately i saw a question in one of spring ldap forums, were one of guys there asked this question:
How can i connect ldap without using spring xml (application context xml file).
My answer to him was that that i prefer and need in my project to use it dynamically intead of known configuration that can be configured in spring application context file (beans).
This was my solution for him:
LdapContextSource ldapContextSource = new LdapContextSource();
ldapContextSource.setUrl("ldap://localhost:portnumber");
ldapContextSource.setBase("ou=users, ou=system");//*
ldapContextSource.setUserDn("username to connect");
ldapContextSource.setPassword("password");
ldapContextSource.afterPropertiesSet();
//* the base is not necessary needed, it depends what do you need.
Bye,
Dor
Lately i saw a question in one of spring ldap forums, were one of guys there asked this question:
How can i connect ldap without using spring xml (application context xml file).
My answer to him was that that i prefer and need in my project to use it dynamically intead of known configuration that can be configured in spring application context file (beans).
This was my solution for him:
LdapContextSource ldapContextSource = new LdapContextSource();
ldapContextSource.setUrl("ldap://localhost:portnumber");
ldapContextSource.setBase("ou=users, ou=system");//*
ldapContextSource.setUserDn("username to connect");
ldapContextSource.setPassword("password");
ldapContextSource.afterPropertiesSet();
//* the base is not necessary needed, it depends what do you need.
Bye,
Dor
No comments:
Post a Comment