简体   繁体   中英

how to set up dirContextValidator?

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 ?

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" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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