contextSource.setUrl("ldap://localhost:"+Integer.toString(getLdapPort()));
contextSource.setBase(baseDN);
contextSource.setUserDn("uid=admin,ou=system");
contextSource.setPassword("secret");
contextSource.setPooled(false);
contextSource.afterPropertiesSet();
PoolingContextSource pcs = new MutablePoolingContextSource();
pcs.setContextSource(contextSource);
ldapTemplate = new LdapTemplate(pcs);