I want to declare a LDAP resource in tc Server's context.xml
I am not sure why you want to declare your Spring LDAP context source in your server's configuration file. I would just declare the context source in the spring configuration file. Here is an example:
Code:
<bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">
<property name="url" value="ldap://localhost:389" />
<property name="base" value="dc=example,dc=com" />
<property name="userDn" ref="example user dn" />
<property name="password" ref="example password" />
</bean>
You might also want to create a Spring LDAP template that uses this context source:
Code:
<bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
<constructor-arg ref="contextSource" />
</bean>
Now you can just inject the LDAP template into your spring bean and use it to read LDAP entries.