[bs-73] Tweak algorithm for detecting anonymous classes

Apparently an anonymous class in Groovy is no anonymous in the compiled code,
so we need another heuristic.  We now check for non-existence of public
constructors (if there are none then there's no point regsistering that
class with an application context).

[#48718891]
This commit is contained in:
Dave Syer 2013-04-25 16:51:11 +01:00
parent a2d328ae3a
commit d82c50804f

View File

@ -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;