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
MethodParameter.equals is too coarse-grained for its use in HandlerMethodArgumentResolverComposite #23352
Comments
Fixes spring-projects#3004 Change the `DefaultMessageHandlerMethodFactory` beans to prototype scope. See spring-projects/spring-framework#23352
Fixes #3004 Change the `DefaultMessageHandlerMethodFactory` beans to prototype scope. See spring-projects/spring-framework#23352
Update `MethodParameter` so that the `equals()` and `hashCode()` methods consider both the `containingClass` and the `nestingLevel`. Closes spring-projectsgh-23352
I've refined |
Update `MethodParameter` so that the `equals()` and `hashCode()` methods consider both the `containingClass` and the `nestingLevel`. Closes spring-projectsgh-23352
Update `MethodParameter` so that the `equals()` and `hashCode()` methods consider both the `containingClass` and the `nestingLevel`. Closes spring-projectsgh-23352
Update `MethodParameter` so that the `equals()` and `hashCode()` methods consider both the `containingClass` and the `nestingLevel`. Closes spring-projectsgh-23352
See #3004 spring-projects/spring-framework#23352 is now resolved so the `DefaultMessageHandlerMethodFactory` can be singletons.
@garyrussell A minimal fix for this through a narrowed |
Doing one more pass over this since the previous fix didn't take overridden |
@jhoeller I already reverted the workaround on master yesterday and all is fine; thanks! I am building our 5.1.x against 5.1.9 snapshots and don't see any problems there either (although we only had the problem on master, when we went to a shared handler factory across multiple components). |
Cool, good to know :-) I've also taken overridden containing classes into account now, just in cases somebody uses those on |
HandlerMethodArgumentResolverComposite
usesMethodParameter
as a cache key forHandlerMethodArgumentResolver
.Consider:
MethodParameter.executable
in both cases is the interfaceMethod
:When invoking the second method, we get a cache hit and fail with a class cast exception because the wrong argument resolver is returned.
Spring Integration recently changed to use a shared
DefaultMessageHandlerMethodFactory
@Bean
, and hence a sharedHandlerMethodArgumentResolverComposite
.We can work around this by changing the bean scope to prototype, but I think the
hashCode()
andequals()
should include at least thecontainingClass
and/orparameterType
field.See spring-projects/spring-integration#3004
The text was updated successfully, but these errors were encountered: