spring-projects / spring-projects/spring-ldap

Pooling with LdapRepository

Open
#472 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
375
Forks
501
Avg merge
6h 4m
Merged PRs (30d)
63

Description

When using LdapTemplate to explicitly execute LDAP queries, we could configure connection pooling parameters within @Configuration like the following:

    @Bean
    public LdapTemplate ldapTemplate() throws Exception {
        return new LdapTemplate(poolingLdapContextSource());
    }

    @Bean
    public ContextSource poolingLdapContextSource() {
    	
        PoolingContextSource poolingContextSource = new PoolingContextSource();
        poolingContextSource.setDirContextValidator(new DefaultDirContextValidator());
        poolingContextSource.setContextSource(ldapContextSource());
        poolingContextSource.setMaxActive(maxActive);
        poolingContextSource.setMaxTotal(maxTotal);
        poolingContextSource.setMaxIdle(maxIdle);
        poolingContextSource.setMinIdle(minIdle);
        poolingContextSource.setMaxWait(maxWait);
        poolingContextSource.setWhenExhaustedAction(new Byte(whenExhaustedAction));
        poolingContextSource.setTestOnBorrow(testOnBorrow);
        poolingContextSource.setTestWhileIdle(testWhileIdle);
        poolingContextSource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
        poolingContextSource.setNumTestsPerEvictionRun(numTestsPerEvictionRun);
        poolingContextSource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
        
        return poolingContextSource;
    }

Question: However, when using LdapRepository, which takes care of implementing CRUD operations for me, there is no need for explicit queries using LdapTemplate (at least for simple use-cases).
How can I configure the @Repository to use connection pooling? and how can I set pooling parameters?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how LdapRepository obtains its context and how LdapTemplate is configured, then compare that path with the PoolingContextSource example in the issue. Determine whether repository pooling is already configurable or requires a new integration, and verify that all requested pooling parameters can be applied through @Configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.