Skip to content
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

Destroy callback cannot be disabled for AutoCloseable beans [SPR-13022] #17613

spring-issuemaster opened this issue May 13, 2015 · 0 comments


Copy link

commented May 13, 2015

Stéphane Nicoll opened SPR-13022 and commented

The destroyMethod argument of @Bean is (inferred) which will try to find a matching destroy method (close and shutdown).

If one wants to disable this behaviour, the documented approach is to override that argument with the empty string, something like @Bean(destroyMethod="").

This does not work for Closeable (AutoCloseable) beans as the callback is invoked no matter what.

Affects: 4.0 GA

Issue Links:

  • #17633 Add description of Closeable and AutoCloseable in reference document
  • #18494 Spring fails to find bean's destroy method in case there is a bridge method
  • #17153 Document how to prevent a JNDI DataSource retrieved using JavaConfig to be removed on shutdown of the context

Referenced from: commits 0ed9ca0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.