Improve GenericTypeResolver to resolve type variable recursively
Fix GH-24963
This commit is contained in:
committed by
Juergen Hoeller
parent
4b2e40153a
commit
e788aeb25b
@@ -67,6 +67,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
* @author Sebastien Deleuze
|
||||
* @author Yanming Zhou
|
||||
* @since 4.2
|
||||
*/
|
||||
public class ApplicationListenerMethodAdapter implements GenericApplicationListener {
|
||||
@@ -177,13 +178,14 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
|
||||
return true;
|
||||
}
|
||||
if (PayloadApplicationEvent.class.isAssignableFrom(eventType.toClass())) {
|
||||
if (eventType.hasUnresolvableGenerics()) {
|
||||
return true;
|
||||
}
|
||||
ResolvableType payloadType = eventType.as(PayloadApplicationEvent.class).getGeneric();
|
||||
if (declaredEventType.isAssignableFrom(payloadType)) {
|
||||
return true;
|
||||
}
|
||||
if (payloadType.resolve() == null) {
|
||||
// Always accept such event when the type is erased
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user