GH-444 Fixed support for default function lookup

Given that function can be looked up with no definition, the fallback alternative should be 'spring.cloud.function.definition' property

Resolves #444
This commit is contained in:
Oleg Zhurakousky
2020-01-28 15:50:42 +01:00
parent 35d3c45959
commit d334ed609c
3 changed files with 32 additions and 1 deletions

View File

@@ -125,6 +125,9 @@ public class BeanFactoryAwareFunctionRegistry
@Override
@SuppressWarnings("unchecked")
public <T> T lookup(String definition, String... acceptedOutputTypes) {
if (!StringUtils.hasText(definition)) {
definition = this.applicationContext.getEnvironment().getProperty("spring.cloud.function.definition");
}
Object function = this.proxyInvokerIfNecessary((FunctionInvocationWrapper) this.compose(null, definition, acceptedOutputTypes));
return (T) function;
}