use of org.springframework.boot.autoconfigure.ldap.LdapProperties.Template in project spring-boot by spring-projects.
the class LdapAutoConfiguration method ldapTemplate.
@Bean
@ConditionalOnMissingBean(LdapOperations.class)
public LdapTemplate ldapTemplate(LdapProperties properties, ContextSource contextSource) {
Template template = properties.getTemplate();
PropertyMapper propertyMapper = PropertyMapper.get().alwaysApplyingWhenNonNull();
LdapTemplate ldapTemplate = new LdapTemplate(contextSource);
propertyMapper.from(template.isIgnorePartialResultException()).to(ldapTemplate::setIgnorePartialResultException);
propertyMapper.from(template.isIgnoreNameNotFoundException()).to(ldapTemplate::setIgnoreNameNotFoundException);
propertyMapper.from(template.isIgnoreSizeLimitExceededException()).to(ldapTemplate::setIgnoreSizeLimitExceededException);
return ldapTemplate;
}
use of org.springframework.boot.autoconfigure.ldap.LdapProperties.Template in project spring-boot by spring-projects.
the class LdapPropertiesTests method ldapTemplatePropertiesUseConsistentLdapTemplateDefaultValues.
@Test
void ldapTemplatePropertiesUseConsistentLdapTemplateDefaultValues() {
Template templateProperties = new LdapProperties().getTemplate();
LdapTemplate ldapTemplate = new LdapTemplate();
assertThat(ldapTemplate).hasFieldOrPropertyWithValue("ignorePartialResultException", templateProperties.isIgnorePartialResultException());
assertThat(ldapTemplate).hasFieldOrPropertyWithValue("ignoreNameNotFoundException", templateProperties.isIgnoreNameNotFoundException());
assertThat(ldapTemplate).hasFieldOrPropertyWithValue("ignoreSizeLimitExceededException", templateProperties.isIgnoreSizeLimitExceededException());
}
Aggregations