[英]How to verify Spring LDAP connection pooling configuration?
我已经在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
问题:
一年或更长时间后,现在可能无法为您提供帮助,但是即使有了TRACE, org.springframework.ldap
或org.springframework.security
不再提供日志记录。
您可以通过另外两种方式向自己证明。
不提供非池化的LdapContextSource
。 只需以编程方式将PoolingContextSource.setContextSource()
提供给PoolingContextSource.setContextSource()
在调试中运行服务器,并在PoolingContextSource.getContext()
放置一个断点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.