[bs-73] Tweak algorithm for detecting anonymous classes

@Bean definitions in Groovy that contain closures have the bean name in
the class name.  Ugh.  Added regex match to catch that.

[#48718891]
This commit is contained in:
Dave Syer
2013-04-26 12:02:49 +01:00
parent ec351e5f7d
commit 10c333ea10
5 changed files with 48 additions and 9 deletions

View File

@@ -163,7 +163,7 @@ class BeanDefinitionLoader {
}
// Nested anonymous classes are not eligible for registration, nor are groovy
// closures
if (type.isAnonymousClass() || type.getName().contains("$_closure")
if (type.isAnonymousClass() || type.getName().matches(".*\\$_.*closure.*")
|| type.getConstructors() == null || type.getConstructors().length == 0) {
return false;
}