我已在Spring啟動應用程式中為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:debug
org.springframework.ldap.pool:debug
在日志中,我看到以下内容:
17-10-10 16:11:12:976 DEBUG o.s.l.c.s.AbstractContextSource - AuthenticationSource not set - using default implementation
2017-10-10 16:11:12:976 DEBUG o.s.l.c.s.AbstractContextSource - **Not using LDAP pooling**
2017-10-10 16:11:12:976 DEBUG o.s.l.c.s.AbstractContextSource - Trying provider Urls: ldap://xxx:389 ldap://yyy:389
問題:
為什麼日志說"不使用LDAP池"?
如何獲得有關池的更詳細日志記錄,以便更深入地了解Spring何時打開新連接配接,存在多少活動連接配接等?
醇>