Oliver Drotbohm opened SPR-16872 and commented

ConfigurableApplicationContext currently exposes addApplicationListener(…) which unfortunately isn't usable with lambdas as they don't retain generics information that's used downstream to properly route events to.

It would be cool if there was an overload addApplicationListener(Class<T> type, Consumer<T> consumer) that internally creates a GenericApplicationListenerAdapter to carry the type information forward.


Issue Links: - #20002 Introduce API to select application listeners - #21508 Resolved ApplicationListener event type should get cached