-1

I currently working with LDAP using Spring Security with XML Configuration. I need advice about how can i put attributes like URL, port, manager-dn and password in external file.

<ldap-server id="ldapServer"
        url="ldap://xxxxx:3268/dc=xxxxx,dc=com" port="3268"
        manager-dn="[email protected]" manager-password="xxxxxx" />

i mean, we need to put it externally because our other team (implementation team) need to change those properties values to go live without changing anything in war/binary file. Thank you

1

1 Answer 1

0

Done, thanks to this post

Steps :

  1. create properties file and put it in the server

####### LDAP ##############
ldap.urls= ldap://xxxx:3268/dc=xxxxx,dc=com
ldap.manager-dn= [email protected]
ldap.manager-password= xxxx

  1. create properyplaceholder bean

<beans:bean
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <beans:property name="location">
            <beans:value>file:///opt/xxxx/xxxxx/application.properties</beans:value>
        </beans:property>
    </beans:bean>

  1. access the properties from XML beans

<ldap-server id="ldapServer" url="${ldap.urls}" port="3268"
        manager-dn="${ldap.manager-dn}"
        manager-password="${ldap.manager-password}" />

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.