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

Document inference of destroy methods with Java config more prominently #29546

Closed
wilkinsona opened this issue Nov 22, 2022 · 1 comment
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: documentation A documentation task
Milestone

Comments

@wilkinsona
Copy link
Member

Affects: 5.3

Java configuration infers destroy methods, looking for methods named shutdown and close. This is documented, but in a way that is very XML-focused:

You can assign the destroy-method attribute of a element a special (inferred) value, which instructs Spring to automatically detect a public close or shutdown method on the specific bean class. (Any class that implements java.lang.AutoCloseable or java.io.Closeable would therefore match.) You can also set this special (inferred) value on the default-destroy-method attribute of a element to apply this behavior to an entire set of beans (see Default Initialization and Destroy Methods). Note that this is the default behavior with Java configuration.

You have to persevere and read several sentences that are XML-specific to learn that Java configuration has this behavior. I think the inference should be documented more prominently and with a Java-first approach. I think it may even warrant a separate (sub-)section rather than being tucked away in a tip.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Nov 22, 2022
@sbrannen
Copy link
Member

It's actually documented here.

But that's also a "tip", and it's in a completely different section of that chapter.

So there's certainly room for improvement here.

@sbrannen sbrannen added type: documentation A documentation task in: core Issues in core modules (aop, beans, core, context, expression) and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 22, 2022
@sbrannen sbrannen modified the milestones: 5.3.x, 6.0.2, 6.0.x Nov 22, 2022
@sdeleuze sdeleuze modified the milestones: 6.0.x, 6.1.x Mar 7, 2023
@jhoeller jhoeller modified the milestones: 6.1.x, 6.0.12 Aug 18, 2023
@jhoeller jhoeller self-assigned this Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: documentation A documentation task
Projects
None yet
Development

No branches or pull requests

5 participants