diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/BeanDefinitionLoader.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/BeanDefinitionLoader.java index 0305c1763d..53f66aa3ec 100644 --- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/BeanDefinitionLoader.java +++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/BeanDefinitionLoader.java @@ -156,7 +156,8 @@ class BeanDefinitionLoader { private boolean isComponent(Class type) { // Nested anonymous classes are not eligible for registration, nor are groovy // closures - if (type.isAnonymousClass() || type.getName().contains("$_closure")) { + if (type.isAnonymousClass() || type.getName().contains("$_closure") + || type.getConstructors() == null || type.getConstructors().length == 0) { return false; } return true;