santoshB
Mar 7th, 2007, 04:19 AM
I am using spring-LDAP 1.1.1. The context configuration is as below.
<bean id="contextSource" class="org.springframework.ldap.support.LdapContextSource">
<property name="url" value="ldap://<hostname>:389" />
<property name="base" value="<base>" />
<property name="userName" value="<user ID>" />
<property name="password" value="<password>" />
</bean>
<bean id="ldapTemplate" class="org.springframework.ldap.LdapTemplate">
<constructor-arg ref="contextSource" />
</bean>
In my code, I use the ldapTemplate to interact with LDAP.
When the code is moved to a different environment, the properties change. One way I thought to handle it is - to define the beans something like contextSource_DEV, contextSource_STAGING, contextSource_PROD and use them accordingly depending on the environment specific system property.
Is there any other better way of doing it - doing it just with the configuration, without having to change the code. Let me know if there is any documentation for the same.
Thanks
santosh
<bean id="contextSource" class="org.springframework.ldap.support.LdapContextSource">
<property name="url" value="ldap://<hostname>:389" />
<property name="base" value="<base>" />
<property name="userName" value="<user ID>" />
<property name="password" value="<password>" />
</bean>
<bean id="ldapTemplate" class="org.springframework.ldap.LdapTemplate">
<constructor-arg ref="contextSource" />
</bean>
In my code, I use the ldapTemplate to interact with LDAP.
When the code is moved to a different environment, the properties change. One way I thought to handle it is - to define the beans something like contextSource_DEV, contextSource_STAGING, contextSource_PROD and use them accordingly depending on the environment specific system property.
Is there any other better way of doing it - doing it just with the configuration, without having to change the code. Let me know if there is any documentation for the same.
Thanks
santosh