1

I have got the answers for setting up LdapContextSource and LdapTemplate without XML configurations from the SO question Best practice for configuring Spring LdapTemplate via annotations instead of XML?

What should be the annotation way for the below xml - automatically creating repository beans based on interfaces?

<ldap:repositories base-package="org.springframework.ldap.samples.useradmin.domain" />
Community
  • 1
  • 1
niro
  • 405
  • 4
  • 8

1 Answers1

3

Something like this.

@Configuration
@EnableLdapRepositories("org.springframework.ldap.samples.useradmin.domain")
public class LdapConfiguration { ... }

The @EnableLdapRepositories takes care of adding the correct configuration and scanning for repositories.

M. Deinum
  • 115,695
  • 22
  • 220
  • 224
  • And dependency ` org.springframework.boot spring-boot-starter-data-jpa ` should be added to use CrudRepository – niro Sep 16 '15 at 07:21
  • No it shouldn't... That is for JPA not for LDAP... You should just add the `spring-data-commons` dependency. – M. Deinum Sep 16 '15 at 07:23