|
33 | 33 | import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
34 | 34 | import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
35 | 35 | import org.springframework.core.ResolvableType;
|
36 |
| -import org.springframework.core.ResolvableTypeProvider; |
37 | 36 | import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
38 |
| -import org.springframework.lang.NonNull; |
39 | 37 | import org.springframework.lang.Nullable;
|
40 | 38 | import org.springframework.util.Assert;
|
41 | 39 | import org.springframework.util.ClassUtils;
|
@@ -291,12 +289,9 @@ static boolean supportsEvent(ResolvableType callbackType, ResolvableType entityT
|
291 | 289 | static boolean supportsEvent(EntityCallback<?> callback, ResolvableType entityType,
|
292 | 290 | ResolvableType callbackType) {
|
293 | 291 |
|
294 |
| - ResolvableType callbackInstanceType = callback instanceof EntityCallbackAdapter<?> provider |
295 |
| - ? provider.getResolvableType() |
296 |
| - : ResolvableType.forInstance(callback); |
297 |
| - |
298 |
| - return supportsEvent(callbackInstanceType, entityType) |
299 |
| - && callbackType.isAssignableFrom(callbackInstanceType); |
| 292 | + return callback instanceof EntityCallbackAdapter<?> provider |
| 293 | + ? provider.supports(callbackType, entityType) |
| 294 | + : callbackType.isInstance(callback) && supportsEvent(ResolvableType.forInstance(callback), entityType); |
300 | 295 | }
|
301 | 296 |
|
302 | 297 | /**
|
@@ -346,12 +341,10 @@ void discoverEntityCallbacks(BeanFactory beanFactory) {
|
346 | 341 | * @author Oliver Drotbohm
|
347 | 342 | */
|
348 | 343 | private static record EntityCallbackAdapter<T>(EntityCallback<T> delegate, ResolvableType type)
|
349 |
| - implements EntityCallback<T>, ResolvableTypeProvider { |
| 344 | + implements EntityCallback<T> { |
350 | 345 |
|
351 |
| - @NonNull |
352 |
| - @Override |
353 |
| - public ResolvableType getResolvableType() { |
354 |
| - return type; |
| 346 | + boolean supports(ResolvableType callbackType, ResolvableType entityType) { |
| 347 | + return callbackType.isInstance(delegate) && supportsEvent(type, entityType); |
355 | 348 | }
|
356 | 349 | }
|
357 | 350 |
|
|
0 commit comments