Best practice for configuring Spring LdapTemplate via annotations instead of XML?

Why all the subclasses? Just use configuration to configure the beans. Either XML or Java Config. @Configuration public class LdapConfiguration { @Autowired Environment env; @Bean public LdapContextSource contextSource () { LdapContextSource contextSource= new LdapContextSource(); contextSource.setUrl(env.getRequiredProperty(“ldap.url”)); contextSource.setBase(env.getRequiredProperty(“ldap.base”)); contextSource.setUserDn(env.getRequiredProperty(“ldap.user”)); contextSource.setPassword(env.getRequiredProperty(“ldap.password”)); return contextSource; } @Bean public LdapTemplate ldapTemplate() { return new LdapTemplate(contextSource()); } } Your DirectoryService can remain … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)