This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.
I think I'm beginning to see how I could possibly do it outside of a spring context. I think I would do something like
LdapTemplate ldapTemplate = new LdapTemplate(contextSource);
where contextSource is a class I write that extends LdapContextSource in which I implement getDirContextInstance() and inside that I can put some previous code I wrote "in the old days" to set up a DirContext.
Assuming that will work, my next question is (which I could determine by testing it but I'll try this tomorrow) do I need to include in my classpath all of the libraries in the lib directory; e.g.,
Last edited by lumpynose; Oct 13th, 2006, 01:26 AM.
Sorry, I'm not sure if I explained it correctly because I don't understand your answer. I'm writing a module / class for someone else's app and part of what my module will be doing is some ldap lookups. The other app isn't using spring.
When you say "call afterPropertiesSet() once the instance properties have been initialized" I'm guessing you mean to call that method on the LdapTemplate object? But I don't understand how it will get a ContextSource unless I provide it with one, and I don't understand where to get a ContextSource unless I create one.
Since this is not running in spring there won't be any spring beans, which is where I'd ordinarly define my ContextSource.
You'll need to manually create your LdapContextSource instance, set the desired properties on that instance and then call afterPropertiesSet() on the LdapContextSource instance. Then you create your LdapTemplate instance, supply the LdapContextSource to that, and you're all set to do your LDAP operations.