BeanFactoryAnnotationUtils.qualifiedBeanOfType should not instantiate all beans of given type before checking qualifier [SPR-13741] #18314
Comments
Juergen Hoeller commented Good point: This is an unfortunate assumption in Juergen |
Jakub Bochenski commented Thanks - that was fast reaction. Actually I've run into this when using a custom (multiton-type) scope bean, so hopefully the planned patch will address this case too? (Just ensuring " non-singleton" doesn't really mean "prototype" :)) |
Juergen Hoeller commented I can confirm that non-singletons means prototypes as well as beans in custom scopes :-) The fix is simply to use iteration via Juergen |
Juergen Hoeller commented Jakub Bochenski, could you please give a recent Juergen |
Jakub Bochenski commented TBH the application I got this problem with is still stuck with Spring 3.x -- I'll be trying to backport this and let you know soon |
Juergen Hoeller commented Actually, I've considered backporting this to 3.2.16 already. I can do this later today, so the change will be available in a Juergen |
Jakub Bochenski commented Wow, I wish all OSS projects had such snappy support (cough maven cough) |
Juergen Hoeller commented Today's Juergen |
Jakub Bochenski commented Confirmed against 3.2.16.BUILD-20151203.121416-6 -- working as expected |
Juergen Hoeller commented Great to hear - thanks for the timely feedback! Juergen |
Jakub Bochenski opened SPR-13741 and commented
Basically what was reported on SO
Offending line: ```
Map<String, T> candidateBeans = BeanFactoryUtils.beansOfTypeIncludingAncestors(bf, beanType);
Affects: 3.2.15, 4.1.8, 4.2.3
Reference URL: https://stackoverflow.com/questions/27177364/spring-candidate-bean-type-strategy-is-bad
Issue Links:
Backported to: 4.1.9, 3.2.16
The text was updated successfully, but these errors were encountered: