diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassUtils.java b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassUtils.java index 38d2103eac..e2d4e7cfa6 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassUtils.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassUtils.java @@ -161,12 +161,24 @@ abstract class ConfigurationClassUtils { if (metadata.isInterface()) { return false; } + + // Any of the typical annotations found? for (String indicator : candidateIndicators) { if (metadata.isAnnotated(indicator)) { return true; } } - return metadata.hasAnnotatedMethods(Bean.class.getName()); + + // Finally, let's look for @Bean methods... + try { + return metadata.hasAnnotatedMethods(Bean.class.getName()); + } + catch (Throwable ex) { + if (logger.isDebugEnabled()) { + logger.debug("Failed to introspect @Bean methods on class [" + metadata.getClass() + "]: " + ex); + } + return false; + } } /**