-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Inferring an ApplicationListener's event type from a lambda or method reference [SPR-10675] #15303
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
Comments
Phil Webb commented At a guess, I would say that |
Nick Williams commented Is this still planned for being fixed in Spring 4.2? |
Juergen Hoeller commented If we're trying to support this along the lines of #17130, retrieving the declared type from the lambda-defined instance, we have no acceptable way to retrieve that information yet. See my comment on that issue: hacking into the JVM constant pool isn't really feasible there. As an alternative, we may also try to introspect the method's return type declaration along the lines of #16146. That will obviously only work for factory methods, not for programmatically registered listener instances, and only if the factory method redeclares the generic event type. Juergen |
I think this has now been superseded by #23178 which has just been fixed for RC1. |
Nick Williams opened SPR-10675 and commented
This works:
These two variations do not:
With either of these last two, Spring never starts. The following output is logged:
It seems to me that this should work. Perhaps a tweak to the listener registry to detect the method argument type from lambdas and references, too, instead of just regular and anonymous classes.
Affects: 4.0 M1
Issue Links:
@Aspect
aspect not correctly applied to Java 8 lambda-defined@Beans
2 votes, 8 watchers
The text was updated successfully, but these errors were encountered: