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

Clarify Bean destroyMethod documentation [SPR-16078] #20627

Closed
spring-projects-issues opened this issue Oct 16, 2017 · 1 comment
Closed

Clarify Bean destroyMethod documentation [SPR-16078] #20627

spring-projects-issues opened this issue Oct 16, 2017 · 1 comment
Assignees
Labels
status: backported An issue that has been backported to maintenance branches type: documentation A documentation task
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Oct 16, 2017

Cameron Steffen opened SPR-16078 and commented

This paragraph seems to imply that setting destroyMethod="" will not disable destroy method inference for DisposableBean, Closeable and AutoCloseable beans.

To disable destroy method inference for a particular @Bean, specify an empty string as the value, e.g. @Bean(destroyMethod=""). Note that the DisposableBean and the Closeable/AutoCloseable interfaces will nevertheless get detected and the corresponding destroy/close method invoked.


Reference URL: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/annotation/Bean.html#destroyMethod--

Issue Links:

Referenced from: commits d1b5b5d, dff2c84

Backported to: 4.3.13

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

That paragraph is indeed not entirely correct: We always honor the DisposableBean callback interface but consider Closeable / AutoCloseable as part of destroy method inference. As a consequence, destroyMethod="" only affects the latter but not DisposableBean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: backported An issue that has been backported to maintenance branches type: documentation A documentation task
Projects
None yet
Development

No branches or pull requests

2 participants