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

Deprecate inappropriate getBeanFactory() method in AbstractBeanDefinitionReader #27875

Closed
Mozartaa opened this issue Jan 3, 2022 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@Mozartaa
Copy link

Mozartaa commented Jan 3, 2022

in spring5.3.10 version
A public method is provided in the AbstractBeanDefinitionReader class,

public final BeanDefinitionRegistry getBeanFactory() {
     return this.registry;
}

This method does not have any notes, and the type returned is a BeanDefinitionRegistry, but the method name is getBeanFactory. However, BeanDefinitionRegistry doesn't extends BeanFactory, so naming it is easy to mislead everyone, getRegistry() method has been provided,
So I think the getBeanFactory method should be removed.
image

@sbrannen
Copy link
Member

sbrannen commented Jan 3, 2022

Good catch, @Mozartaa, and thanks for raising your first issue for the Spring Framework! 👍

I think it's safe to assume that this method was introduced by accident more than 13 years ago (i.e., before we moved to GitHub).

So we'll deprecate that method in 5.3.x and remove it in 6.0.

@sbrannen sbrannen changed the title Inappropriate method name of the getBeanFactory in AbstractBeanDefinitionReader class Deprecate inappropriate getBeanFactory() method in AbstractBeanDefinitionReader Jan 3, 2022
@sbrannen sbrannen self-assigned this Jan 3, 2022
@sbrannen sbrannen added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement labels Jan 3, 2022
@sbrannen sbrannen added this to the 5.3.15 milestone Jan 3, 2022
sbrannen added a commit that referenced this issue Jan 4, 2022
The getBeanFactory() method (which is deprecated since Spring Framework
5.3.15) has been obsolete for more than 13 years since it was superseded
by the getRegistry() method in the BeanDefinitionReader interface.

Closes gh-27875
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

2 participants