spring中加载properties文件

来源:互联网 发布:深圳福永美工招聘 编辑:程序博客网 时间:2024/05/01 03:13
Xml代码  收藏代码
  1. <bean id="propertyConfigurer"  
  2.         class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">  
  3.     <property name="location">  
  4.         <value>classpath:ldap.properties</value>  
  5.     </property>  
  6. </bean>  
  7.   
  8. <bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">  
  9.     <property name="url" value="${url}" />  
  10.     <property name="base" value="${base}" />  
  11.     <property name="userDn" value="${userDn}" />  
  12.     <property name="password" value="${password}" />  
  13. </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 
0 0
原创粉丝点击