212.6. LdapConnection
URI ldif:ldapConnectionName
은 ID가 있는 빈( ldapConnectionName
)을 참조합니다. ldapConnection은 LdapConnectionConfig
빈을 사용하여 구성할 수 있습니다. 해당 범위는 연결을 공유하거나 오래된 연결을 선택하는 것을 방지하기 위해 프로토 타
입의 범위를 가져야 합니다.
LdapConnection
빈은 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"/>
또는 OSGi 청사진.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"/>