Fix compiled scripts demo from README

Compiled functions always show up with no metadata, and you can only
guess what the types are from the bean definition. Probably we should
add more information to the bean definition if we have it when we
compile the function.

There is still a problem if user defines functions that are not of
Flux<String> (but that has always been the case).
This commit is contained in:
Dave Syer
2017-05-25 07:51:26 +01:00
parent 41b1a6584e
commit c685866f09
6 changed files with 108 additions and 7 deletions

View File

@@ -35,6 +35,7 @@ import java.util.function.Function;
import java.util.function.Supplier;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.config.BeanDefinition;
@@ -422,7 +423,10 @@ public class ContextFunctionCatalogAutoConfiguration {
param = resolvable.getGeneric(index).getGeneric(0).getType();
}
else {
// TODO: compiled functions only work as String -> String
// TODO: compiled functions (only work as String -> String)
if (paramType.isWrapper()) {
return Flux.class;
}
return String.class;
}
}