Fix issues with binders and BindingProvider

When multiple binders are present with at least one of them is marked with BindingProvider,
it skips scanning functions for regular message channel based binders.

Resolves #1820
This commit is contained in:
Soby Chacko
2019-10-16 18:42:53 -04:00
committed by Oleg Zhurakousky
parent ad64df05a1
commit 713c252576

View File

@@ -588,12 +588,7 @@ public class FunctionConfiguration {
@Override
public void afterPropertiesSet() throws Exception {
Class<?>[] configurationClasses = binderTypeRegistry.getAll().values().iterator().next()
.getConfigurationClasses();
boolean bindingProvider = Stream.of(configurationClasses)
.filter(clazz -> AnnotationUtils.findAnnotation(clazz, BindingProvider.class) != null)
.findFirst().isPresent();
if (!bindingProvider
if (nonBindingProviderBindersFound()
&& ObjectUtils.isEmpty(applicationContext.getBeanNamesForAnnotation(EnableBinding.class))
&& this.determineFunctionName(functionCatalog, environment)) {
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) applicationContext.getBeanFactory();
@@ -626,6 +621,11 @@ public class FunctionConfiguration {
}
}
private boolean nonBindingProviderBindersFound() {
return binderTypeRegistry.getAll().values().stream().anyMatch(binderType -> Stream.of(binderType.getConfigurationClasses())
.anyMatch(clazz -> AnnotationUtils.findAnnotation(clazz, BindingProvider.class) == null));
}
private boolean determineFunctionName(FunctionCatalog catalog, Environment environment) {
String definition = streamFunctionProperties.getDefinition();
if (!StringUtils.hasText(definition)) {