diff --git a/spring-context/src/main/java/org/springframework/context/event/EventListenerMethodProcessor.java b/spring-context/src/main/java/org/springframework/context/event/EventListenerMethodProcessor.java index 191f08925b..703b96f3c9 100644 --- a/spring-context/src/main/java/org/springframework/context/event/EventListenerMethodProcessor.java +++ b/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"); * 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) { - if (!this.nonAnnotatedClasses.contains(targetType) && !isSpringContainerClass(targetType)) { + if (!this.nonAnnotatedClasses.contains(targetType) && + !targetType.getName().startsWith("java") && + !isSpringContainerClass(targetType)) { + Map annotatedMethods = null; try { annotatedMethods = MethodIntrospector.selectMethods(targetType, @@ -155,6 +158,7 @@ public class EventListenerMethodProcessor logger.debug("Could not resolve methods for bean with name '" + beanName + "'", ex); } } + if (CollectionUtils.isEmpty(annotatedMethods)) { this.nonAnnotatedClasses.add(targetType); if (logger.isTraceEnabled()) {