Skip to content

Add properties to control exceptions ignored by LdapTemplate #21289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

filiphr
Copy link
Contributor

@filiphr filiphr commented May 1, 2020

Added properties:

  • ignorePartialResultException - For ignoring PartialResultException when searching with the LdapTemplate
  • ignoreNameNotFoundException - For ignoring NameNotFoundException when searching with the LdapTemplate
  • ignoreSizeLimitExceededException - For ignoring SizeLimitExceededException when searching with the LdapTemplate

I was not sure whether you prefer setting the defaults in the properties as they are done in the target class or use null and only set them when they are explicitly set. I can change it if you prefer to have the defaults in the LdapProperties

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 1, 2020
@wilkinsona
Copy link
Member

Thanks for the PR, @filiphr.

I was not sure whether you prefer setting the defaults in the properties as they are done in the target class or use null and only set them when they are explicitly set.

Where possible, we've been moving towards setting the defaults in the properties and then adding some tests to make sure that out defaults align with the target class's defaults. The default from our @ConfigurationProperties class is then available to users in their IDE when auto-completing the property.

@filiphr
Copy link
Contributor Author

filiphr commented May 1, 2020

Where possible, we've been moving towards setting the defaults in the properties and then adding some tests to make sure that out defaults align with the target class's defaults.

Makes sense. Do you perhaps have some test that you can point me to so I can have a look at it and add it for this as well?

@filiphr
Copy link
Contributor Author

filiphr commented May 1, 2020

I found

@Test
void simpleContainerUseConsistentDefaultValues() {
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
SimpleMessageListenerContainer container = factory.createListenerContainer();
RabbitProperties.SimpleContainer simple = this.properties.getListener().getSimple();
assertThat(simple.isAutoStartup()).isEqualTo(container.isAutoStartup());
assertThat(container).hasFieldOrPropertyWithValue("missingQueuesFatal", simple.isMissingQueuesFatal());
}

I'll do it like that for the LdapProperties as well.

* ignorePartialResultException - For ignoring PartialResultException when searching with the LdapTemplate
* ignoreNameNotFoundException - For ignoring NameNotFoundException when searching with the LdapTemplate
* ignoreSizeLimitExceededException - For ignoring SizeLimitExceededException when searching with the LdapTemplate
@filiphr filiphr force-pushed the ldap-template-config-properties branch from 09e34fd to 2972025 Compare May 1, 2020 12:38
@filiphr
Copy link
Contributor Author

filiphr commented May 1, 2020

Thanks for the hint @wilkinsona. I've amended my commit with and added LdapPropertiesTests

@philwebb philwebb added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels May 1, 2020
@philwebb philwebb added this to the 2.3.x milestone May 1, 2020
@snicoll snicoll modified the milestones: 2.3.x, 2.x, 2.4.x May 8, 2020
@wilkinsona wilkinsona self-assigned this Jul 1, 2020
@wilkinsona wilkinsona modified the milestones: 2.4.x, 2.4.0-M2 Jul 1, 2020
@wilkinsona wilkinsona changed the title Add configuration properties for the LdapTemplate Add properties to control exceptions ignored by LdapTemplate Jul 1, 2020
@wilkinsona wilkinsona closed this in 9981f01 Jul 1, 2020
@wilkinsona
Copy link
Member

Thanks very much, @filiphr. I polished things a little bit in this commit, primarily to group the new properties under spring.ldap.template, aligning them with properties for JdbcTemplate, RabbitTemplate, etc.

@filiphr filiphr deleted the ldap-template-config-properties branch July 1, 2020 10:55
@filiphr
Copy link
Contributor Author

filiphr commented Jul 1, 2020

That's great @wilkinsona. Thanks a lot for merging it and for polishing it. I was not aware about the grouping for the other templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants