我已经在Spring Boot应用程序中为LDAP搜索(不是LDAP绑定)配置了LDAP连接池。 这是我的LDAP配置:
@Bean
public ContextSource poolingLdapContextSource() {
PoolingContextSource poolingContextSource = new PoolingContextSource();
poolingContextSource.setDirContextValidator(new DefaultDirContextValidator());
poolingContextSource.setContextSource(ldapContextSource());
return poolingContextSource;
}
@Bean
public LdapContextSource ldapContextSource() {
LdapContextSource contextSource = new LdapContextSource();
contextSource.setUrls(ldapUrls.toArray(new String[]{}));
contextSource.setUserDn(ldapUsername);
contextSource.setPassword(ldapPassword);
contextSource.setPooled(false);
return contextSource;
}
@Bean
public LdapTemplate ldapTemplate() throws Exception {
return new LdapTemplate(poolingLdapContextSource());
}
我已在application.yml中启用调试日志记录,如下所示:
org.springframework.ldap:调试
org.springframework.ldap.pool:调试
在日志中,我看到以下内容:
17-10-10 16:11:12:976 DEBUG oslcsAbstractContextSource - AuthenticationSource not set - using default implementation 2017-10-10 16:11:12:976 DEBUG oslcsAbstractContextSource - **Not using LDAP pooling** 2017-10-10 16:11:12:976 DEBUG oslcsAbstractContextSource - Trying provider Urls: ldap://xxx:389 ldap://yyy:389
问题:
为什么日志显示“不使用LDAP池”?
如何获取有关池的更详细的日志记录,如何更深入地了解何时Spring打开新连接,存在多少活动连接等?