Add test and fix type inspection for scanned functions

Fixes gh-73
This commit is contained in:
Dave Syer
2017-06-28 11:00:07 +01:00
parent e4b181d0c4
commit f94d672dc4
4 changed files with 152 additions and 2 deletions

View File

@@ -409,8 +409,18 @@ public class ContextFunctionCatalogAutoConfiguration {
}
else if (source instanceof FileSystemResource) {
try {
Type type = ClassUtils.forName(definition.getBeanClassName(), null);
param = extractType(type, paramType, index);
Class<?> beanType = ClassUtils.forName(definition.getBeanClassName(),
null);
for (Type type : beanType.getGenericInterfaces()) {
if (type.getTypeName().startsWith("java.util.function")) {
param = extractType(type, paramType, index);
break;
}
}
if (param == null) {
// Last chance
param = beanType;
}
}
catch (ClassNotFoundException e) {
throw new IllegalStateException(