<bean id="idsContextSource" class="org.springframework.ldap.support.LdapContextSource">
<property name="urls" value="${idsurl}" />
<property name="base" value="${idsbase}" />
<property name="userName" value="${idsuserName}" />
<property name="password" value="${idspassword}" />
<property name="dirObjectFactory" value="org.springframework.ldap.support.DefaultDirObjectFactory" />
</bean>
<bean id="idsLdapOperations" class="org.springframework.ldap.LdapTemplate">
<constructor-arg  ref="idsContextSource" />
</bean>最好每一个标签前面加一句注解

解决方案 »

  1.   


    <!--定义了一个名称为idsContextSource的LdapContextSource实例-->
    <bean id="idsContextSource" class="org.springframework.ldap.support.LdapContextSource">
    <!--这个类中为以下了几个属性进行赋值,也就是通过设置注入-->
    <property name="urls" value="${idsurl}" />
    <property name="base" value="${idsbase}" />
    <property name="userName" value="${idsuserName}" />
    <property name="password" value="${idspassword}" />
    <property name="dirObjectFactory" value="org.springframework.ldap.support.DefaultDirObjectFactory" />
    </bean>
    <!--定义了一个名称为idsLdapOperations的LdapTemplate实例
    这个类通过构造函数进行注入-->
    <bean id="idsLdapOperations" class="org.springframework.ldap.LdapTemplate">
    <constructor-arg ref="idsContextSource" />
    </bean>
      

  2.   

    这段代码写的是两种注入方法,1楼写的很清楚 1.setter 2.构造器