Browse Source

EventListenerMethodProcessor skips annotation search on java classes

Closes gh-22564
pull/22634/head
Juergen Hoeller 7 years ago
parent
commit
88049e9b5c
  1. 8
      spring-context/src/main/java/org/springframework/context/event/EventListenerMethodProcessor.java

8
spring-context/src/main/java/org/springframework/context/event/EventListenerMethodProcessor.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -142,7 +142,10 @@ public class EventListenerMethodProcessor
} }
private void processBean(final String beanName, final Class<?> targetType) { private void processBean(final String beanName, final Class<?> targetType) {
if (!this.nonAnnotatedClasses.contains(targetType) && !isSpringContainerClass(targetType)) { if (!this.nonAnnotatedClasses.contains(targetType) &&
!targetType.getName().startsWith("java") &&
!isSpringContainerClass(targetType)) {
Map<Method, EventListener> annotatedMethods = null; Map<Method, EventListener> annotatedMethods = null;
try { try {
annotatedMethods = MethodIntrospector.selectMethods(targetType, annotatedMethods = MethodIntrospector.selectMethods(targetType,
@ -155,6 +158,7 @@ public class EventListenerMethodProcessor
logger.debug("Could not resolve methods for bean with name '" + beanName + "'", ex); logger.debug("Could not resolve methods for bean with name '" + beanName + "'", ex);
} }
} }
if (CollectionUtils.isEmpty(annotatedMethods)) { if (CollectionUtils.isEmpty(annotatedMethods)) {
this.nonAnnotatedClasses.add(targetType); this.nonAnnotatedClasses.add(targetType);
if (logger.isTraceEnabled()) { if (logger.isTraceEnabled()) {

Loading…
Cancel
Save