Spring Boot + Spring LDAP Advanced LDAP Queries Example

You may also like...

Subscribe
Notify of
guest
4 Comments
Oldest
Newest
Inline Feedbacks
View all comments
meenu
meenu
April 3, 2018 18:53

I am getting error while application start. Description:

Field ldapTemplate in PersonRepository required a bean of type ‘org.springframework.ldap.core.LdapTemplate’ that could not be found.
– Bean method ‘ldapTemplate’ not loaded because @ConditionalOnClass did not find required class ‘org.springframework.data.ldap.repository.LdapRepository’

Any suggestions?

scooty
scooty
April 11, 2018 16:08
Reply to  MemoryNotFound

For anybody encountering this error when trying to create unit tests, you need to add @EnableAutoConfiguration if you are using @SpringBootTest. Here is my full code: @RunWith(SpringRunner.class) @SpringBootTest(classes = {PersonRepository.class}) @TestPropertySource(locations = "classpath:test.yml") @EnableAutoConfiguration public class Tests { @Autowired private PersonRepository personRepository; @Test public void testGetPersonByLastName() { List<Person> names = personRepository.getPersonNamesByLastName("John"); assert(names.size() > 0); } } Additionally, you must do two things for the above code to work. First, you have to create copies of the YAML file (I renamed it to test.yml) and the LDIF file and place them in the ‘resources’ folder in your ‘test’ directory. Second, you… Read more »

Shreya
Shreya
September 2, 2021 11:46

Best article on internet! I am working on a jira story and needed to fetch data from LDAP. This is the only article I found. I followed this and i was able to complete my story using this only article.

Thank you so much once again!

4
0
Would love your thoughts, please comment.x
()
x