Skip to content

Retain merged bean definition caches during post processing #23336

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
philwebb opened this issue Jul 23, 2019 · 0 comments
Closed

Retain merged bean definition caches during post processing #23336

philwebb opened this issue Jul 23, 2019 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@philwebb
Copy link
Member

Currently the RootBeanDefinition used to represent merged bean definitions includes quite a few package private caches. These are currently dropped whenever after bean post processors have run in case post processing causes the bean type to change. In modern Spring applications this is very unlikely to happen and we could benefit my trying to retain cached items if they're still relevant.

@philwebb philwebb added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement labels Jul 23, 2019
@philwebb philwebb added this to the 5.2 RC1 milestone Jul 23, 2019
@philwebb philwebb self-assigned this Jul 23, 2019
philwebb added a commit to philwebb/spring-framework that referenced this issue Jul 23, 2019
Update the logic in `AbstractBeanFactory` so that caches from merged
bean definitions remain whenever possible.

Prior to this commit, all merged bean definitions would be completely
removed after bean post processing in case a processor changed the bean
type. It's fairly unlikely these days that the bean type will actually
change, so instead we now compare a subset of the old cached properties
against the newly created definition. Only if key properties have
changed do we now discard the older cached values.

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

No branches or pull requests

1 participant