Add additional logic to function catalog to help with singletons

A registered singleton doesn't have a BeanDefinition, but it might have
a compiled type with enough generic information to pull out the
input and output types.
This commit is contained in:
Dave Syer
2017-11-10 11:43:44 +00:00
parent 7d7a783f0e
commit ad0ebd5cfc
4 changed files with 149 additions and 40 deletions

View File

@@ -152,8 +152,14 @@ public class StreamListeningFunctionInvoker implements SmartInitializingSingleto
}
else {
for (String candidate : names) {
Class<?> inputType = functionInspector
.getInputType(functionCatalog.lookupFunction(candidate));
Object function = functionCatalog.lookupFunction(candidate);
if (function==null) {
function = functionCatalog.lookupConsumer(candidate);
}
if (function==null) {
continue;
}
Class<?> inputType = functionInspector.getInputType(function);
Object value = this.converter.fromMessage(input, inputType);
if (value != null && inputType.isInstance(value)) {
matches.add(candidate);
@@ -210,7 +216,7 @@ public class StreamListeningFunctionInvoker implements SmartInitializingSingleto
else {
result = this.converter.fromMessage(m, inputType);
}
if (result==null) {
if (result == null) {
result = UNCONVERTED;
}
return result;