213.6. LdapConnection
URI ldif:ldapConnectionName
은 ID인 ldapConnectionName
을 사용하여 빈을 참조합니다. ldapConnection은 LdapConnectionConfig
chain을 사용하여 구성할 수 있습니다. 연결 공유 또는 오래된 연결을 선택하려면 범위에 프로토타입
범위가 있어야 합니다.
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"/>