-
Notifications
You must be signed in to change notification settings - Fork 37.7k
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
Skip overriding primary bean definition with non-primary one #32125
Comments
The appears to be related to: |
That cannot handle autowiring by name usage, and multiple instances are created but only one is needed. |
I understand that the behavior can be rather unintuitive but we've decided no to make further changes in that area. Actually, we're going to deprecate bean definition overriding wholesale, see #31288. |
It make sense that primary bean definition override non-primary one. |
Here is my case, I defined a default bean in xml configuration, sometimes I want override that bean with another implementation via
@Component
and@Primary
, it's fine if injection is autowired by type but not name, the ideal solution is pinning the primary bean definition make it cannot be overridden by non-primary one.Here is test case:
The text was updated successfully, but these errors were encountered: