简体   繁体   English

如何设置 dirContextValidator?

[英]how to set up dirContextValidator?

https://docs.spring.io/spring-ldap/docs/1.3.2.RELEASE/reference/html/pooling.html https://docs.spring.io/spring-ldap/docs/1.3.2.RELEASE/reference/html/pooling.html

open fun create(): LdapTemplate {
        return LdapTemplate(PooledContextSource(
            PoolConfig().apply {
                maxTotalPerKey = 10
                isTestOnBorrow = true
                isTestWhileIdle = true
                minEvictableIdleTimeMillis = timeToMillis
            })
            .apply {
                contextSource = ldapContextSourceFactory.create()
            })
            .apply {
                setIgnorePartialResultException(true)
                afterPropertiesSet()
            }
    }

if add this如果添加这个

isTestOnBorrow = true
isTestWhileIdle = true  

doesn't work不起作用

Failed to borrow DirContext from pool.; nested exception is java.util.NoSuchElementException: Unable to validate object

how to set up dirContextValidator ?如何设置 dirContextValidator ?

Check once your property name is the same or not as mentioned here.检查您的物业名称是否与此处提到的相同。 isTestOnBorrow = true

<property name="testOnBorrow" value="true" />
<property name="testWhileIdle" value="true" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM