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
MVC handler method detection should ignore scopedTarget.x in favor of corresponding proxy bean [SPR-11548] #16173
Comments
Juergen Hoeller commented Dave, ScopedProxyUtils.createScopedProxy does apply setAutowireCandidate(false) to the target definition, and even with a very specific unit test, I'm unable to reproduce the behavior that you're seeing. It works fine for both Juergen |
Dave Syer commented Here's a similar issue (adding
I'll send an issue PR for that, and then keep looking for the Security issue: spring-attic/spring-framework-issues#70 |
Juergen Hoeller commented Indeed, our MVC handler method detection should also ignore scoped targets. We're not explicitly checking any of those flags there, simply treating scoped targets as regular beans... And it probably hasn't been reported simply because people usually don't define scoped proxies for controllers: The MVC dispatching infrastructure can handle lazy beans and scoped beans without scoped proxies as well. So for that part, I'll add some kind of special check to the handler method detection algorithm. Probably not against the autowire-candidate attribute though, otherwise we'd overload the meaning of that flag... After all, people can manually set this to false too, in order to prevent by-type injection; that might make sense for controllers in some scenarios, while still supposed to be detected for MVC dispatching. Juergen |
Dave Syer opened SPR-11548 and commented
According to #11780 I would expect that scoped targets are not autowire candidates and therefore would not cause problems with autowiring using
@Autowired
. But if I define a@Bean @Lazy @Scope(proxyMode=INTERFACES)
all the@Autowired
sites for beans of that type blow up (2 beans of the same type are found: x and scopedTarget.x).Affects: 4.0.2
Issue Links:
0 votes, 6 watchers
The text was updated successfully, but these errors were encountered: