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
BeanFactory.getType(String) may not return a Proxy class depending on the order of bean declarations [SPR-9638] #14272
Comments
Rossen Stoyanchev commented I've added a project reproducing the issue: |
Karsten Sperling commented I'm having the opposite problem, in that In my case the behaviour is even indeterministic, depending on the (varying) order in which |
Marino Debeljuh commented In version 4.3.10 still having same problem. Event listeners somethime throws exception because of this bug. In EventListenerMethodProcessor getType method is used to find target class but instead of proxy class sometime the real implementation class is returned. Because of that in ApplicationListenerMethodAdapter in method assertTargetBean exception is raised because of wrong method resolution (method from real class is executed on proxy instance) |
Marino Debeljuh commented Found quick fix for my problem. getType returns wrong type only for lazy loaded bean (implementation class instead of proxy class). With |
Bulk closing outdated, unresolved issues. Please, reopen if still relevant. |
Rossen Stoyanchev opened SPR-9638 and commented
When one bean tries to find the type of another, via
BeanFactory.getType(String)
, from an initialization method (e.g.InitializingBean
), and when the target bean type is expected to be a JDK dynamic proxy, the actual type returned varies depending on whether the target bean is declared before or after the bean interrogating its type.This is the mechanism used in Spring MVC to discover and cache
@RequestMapping
methods to invoke. Hence it's necessary to the presence of JDK proxies.Affects: 3.1.2
Issue Links:
2 votes, 6 watchers
The text was updated successfully, but these errors were encountered: