Can't get PropertyPlaceholderConfigurer to work

I am using LDAP to authenticate users in a web application. LDAP related beans are configured in a separate file named spring-servlet-security-ldap.xml (called ldap.xml now on). My main web application context file 'spring-servlet.xml' imports spring-servlet-security.xml which again imports the ldap file. This setup works if I do not use the properties file.

I've included the hierarchy details because similar question site PropertyPlaceholderConfigurer being overwritten as the reason.

The properties file for ldap settings is placed in WEB-INF directory.

I've defined the PropertyPlaceholderConfigurer in ldap.xml as follows

<bean id="placeHolderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location"><value>WEB-INF/</value></property>

I am referencing the properties in the same file

<bean id="contextSource" class="" depends-on="placeHolderConfigurer">
    <constructor-arg value="ldap://xx.xx.xx.xx:389/dc=example,dc=com" />
    <property name="userDn"><value>{ldap.userDN}</value></property>
    <property name="password" value="secret" />

The logs indicate that the property is being loaded.

INFO Thread-0 org.springframework.beans.factory.config.PropertyPlaceholderConfigurer - Loading properties file from ServletContext resource [/WEB-INF/]

But the property file is not being referenced for the value and literally configured value is being used. I've verified from the packet traces that the bind request goes for DN {ldap.userDN}.


I think you just need a $ sign for the placeholder: ${ldap.userDN}.

That is the placeholder format that PropertyPlaceholderConfigurer expects by default. This is controlled via the placeholderPrefix and placeholderSuffix properties; by default, ${ and } respectively.

Need Your Help

image transition not working with jquery image centered

jquery html css css3

I have one question about image transition for my script.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.