You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we mark a Map<String, Object> as @bean with a qualifier, @Autowired refers to a different map. The bean seems fine when directly fetched from the application context.
The text was updated successfully, but these errors were encountered:
It will be fine to use @Resource, @Autowired will find candidate by type.
Map, Collection(include Set and List) and Array are different when autowiring. They will find bean which has the same type as the element they storage.
But this shouldn't be the case when we use @Autowire along with a @Qualifier. It should autowire the exact bean. That way, if I have the multiple Maps or Collections of the same element type, I would still be able to autowire a specific bean.
It depends on how to understand the annotation Qualifier. I think that it just provides a candidate, but not change the autowire logic. Maybe I am wrong.
As far as I can tell, this works as of 6.2 due to #28122 - as a welcome side effect of that algorithmic optimization. Feel free to try the recently released 6.2.0-RC1 to double-check.
Affects: 6.1.0
Code:
Output:
When we mark a Map<String, Object> as @bean with a qualifier, @Autowired refers to a different map. The bean seems fine when directly fetched from the application context.
The text was updated successfully, but these errors were encountered: