212.6. LdapConnection
URI인 ldif:ldapConnectionName 은 ID가 ldapConnectionName 인Bean을 참조합니다. LdapConnectionConfig Bean을 사용하여 ldapConnection을 구성할 수 있습니다. 이 범위에는 연결이 공유되거나 오래된 연결을 선택하지 않도록 오토타이프 범위가 있어야 합니다.
LdapConnection Bean은 Spring XML에서 다음과 같이 정의할 수 있습니다.
<bean id="ldapConnectionOptions" class="org.apache.directory.ldap.client.api.LdapConnectionConfig">
<property name="ldapHost" value="${ldap.host}"/>
<property name="ldapPort" value="${ldap.port}"/>
<property name="name" value="${ldap.username}"/>
<property name="credentials" value="${ldap.password}"/>
<property name="useSsl" value="false"/>
<property name="useTls" value="false"/>
</bean>
<bean id="ldapConnectionFactory" class="org.apache.directory.ldap.client.api.DefaultLdapConnectionFactory">
<constructor-arg index="0" ref="ldapConnectionOptions"/>
</bean>
<bean id="ldapConnection" factory-bean="ldapConnectionFactory" factory-method="newLdapConnection" scope="prototype"/>
<bean id="ldapConnectionOptions" class="org.apache.directory.ldap.client.api.LdapConnectionConfig">
<property name="ldapHost" value="${ldap.host}"/>
<property name="ldapPort" value="${ldap.port}"/>
<property name="name" value="${ldap.username}"/>
<property name="credentials" value="${ldap.password}"/>
<property name="useSsl" value="false"/>
<property name="useTls" value="false"/>
</bean>
<bean id="ldapConnectionFactory" class="org.apache.directory.ldap.client.api.DefaultLdapConnectionFactory">
<constructor-arg index="0" ref="ldapConnectionOptions"/>
</bean>
<bean id="ldapConnection" factory-bean="ldapConnectionFactory" factory-method="newLdapConnection" scope="prototype"/>
또는 OSGiECDHE.xml에서 다음을 수행합니다.
<bean id="ldapConnectionOptions" class="org.apache.directory.ldap.client.api.LdapConnectionConfig">
<property name="ldapHost" value="${ldap.host}"/>
<property name="ldapPort" value="${ldap.port}"/>
<property name="name" value="${ldap.username}"/>
<property name="credentials" value="${ldap.password}"/>
<property name="useSsl" value="false"/>
<property name="useTls" value="false"/>
</bean>
<bean id="ldapConnectionFactory" class="org.apache.directory.ldap.client.api.DefaultLdapConnectionFactory">
<argument ref="ldapConnectionOptions"/>
</bean>
<bean id="ldapConnection" factory-ref="ldapConnectionFactory" factory-method="newLdapConnection" scope="prototype"/>
<bean id="ldapConnectionOptions" class="org.apache.directory.ldap.client.api.LdapConnectionConfig">
<property name="ldapHost" value="${ldap.host}"/>
<property name="ldapPort" value="${ldap.port}"/>
<property name="name" value="${ldap.username}"/>
<property name="credentials" value="${ldap.password}"/>
<property name="useSsl" value="false"/>
<property name="useTls" value="false"/>
</bean>
<bean id="ldapConnectionFactory" class="org.apache.directory.ldap.client.api.DefaultLdapConnectionFactory">
<argument ref="ldapConnectionOptions"/>
</bean>
<bean id="ldapConnection" factory-ref="ldapConnectionFactory" factory-method="newLdapConnection" scope="prototype"/>