Justinas Jakavonis
Justinas Jakavonis

Reputation: 8798

Spring Boot LDAP - pooled property for auto configuration

In Spring Boot I can pass properties which will be picked for auto configuration:

Is there any spring.ldap.* property to set pooled=true to avoid using explicit LdapTemplate config?

LdapContextSource contextSource = new LdapContextSource();
contextSource.setPooled(true);

Upvotes: 0

Views: 4234

Answers (3)

Reenactor Rob
Reenactor Rob

Reputation: 1526

Everything that I have read on this recommends that configuration be done using the PoolingContextSource. The LDAP authentication process requires a two-stage process that is problematic. The below is from the blog of Mattias Hellborg Arthursson, a Spring LDAP guru.

Built-in JNDI Connection Pooling

The pooled property of ContextSource has previously defaulted to true, enabling the built-in Java LDAP connection pooling by default. However the built-in LDAP connection pooling suffers from several deficiencies (most notable there is no way of doing connection validation and configuration is cumbersome), which is why we decided to change the default to false . If you require connection pooling we strongly recommend using the Spring LDAP PoolingContextSource instead.

https://blog.jayway.com/2008/10/27/whats-new-in-spring-ldap-13/

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

Upvotes: 1

MikeM
MikeM

Reputation: 71

You can set ldap pool properties with JVM parameters. You specify them when launching your application.

For example:

-Dcom.sun.jndi.ldap.connect.pool.maxsize=10 
-Dcom.sun.jndi.ldap.connect.pool.prefsize=5 
-Dcom.sun.jndi.ldap.connect.pool.timeout=300000

Upvotes: 0

Todd
Todd

Reputation: 31660

According to the Appendix that lists all of the Spring Boot properties, no. I also looked at the LdapProperties class which stores these values at runtime and didn't see anything in there that would help with pooling. I suspect you'll have to keep doing this manually.

Perhaps file a PR on them? They seem open to adding things if there is a need in the community.

Upvotes: 2

Related Questions