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

Package-private init/destroy methods are not always invoked #30718

Closed
sbrannen opened this issue Jun 21, 2023 · 0 comments
Closed

Package-private init/destroy methods are not always invoked #30718

sbrannen opened this issue Jun 21, 2023 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@sbrannen
Copy link
Member

sbrannen commented Jun 21, 2023

Overview

While working on #30692, I noticed that we currently do not invoke shadowed package-private init/destroy methods declared in a different package.

Instead, we only invoke the last such init/destroy method found in the type hierarchy.

We should therefore track "non-visible" package-private init/destroy methods by their fully-qualified method name, analogous to how we track private init/destroy methods.

Related Issues

@sbrannen sbrannen added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) labels Jun 21, 2023
@sbrannen sbrannen added this to the 6.0.11 milestone Jun 21, 2023
@sbrannen sbrannen self-assigned this Jun 21, 2023
mdeinum pushed a commit to mdeinum/spring-framework that referenced this issue Jun 29, 2023
Prior to this commit, if an init/destroy method was package-private and
declared in a superclass in a package different from the package in
which the registered bean resided, a local init/destroy method with the
same name would effectively "shadow" the method from the different
package, resulting in only the local init/destroy method being invoked.

This commit addresses this issue by tracking package-private init
methods from different packages using their fully-qualified method
names, analogous to the existing support for private init/destroy
methods.

Closes spring-projectsgh-30718
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: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant