- <bean id="propertyConfigurer"
- class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="location">
- <value>classpath:ldap.properties</value>
- </property>
- </bean>
- <bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">
- <property name="url" value="${url}" />
- <property name="base" value="${base}" />
- <property name="userDn" value="${userDn}" />
- <property name="password" value="${password}" />
- </bean>
ldap.properties文件:
url=ldap://61.xxx.xxx.xxx:389
base=o=mycom.com,c=cn
userDn=cn=root,o=mycom.com,c=cn
password=secret
本文介绍了一个使用 Spring 框架配置 LDAP 的示例,通过 XML 配置文件加载了外部属性文件 ldap.properties 中的数据,并应用到 LDAP 上下文源 (contextSource) 的配置中。


被折叠的 条评论
为什么被折叠?



