Skip to content

Commit

Permalink
Unncessary warning for multiple functions found
Browse files Browse the repository at this point in the history
Currently we show a warning for multiple functions found even when there
are no functions found and spring.cloud.function.definition is not set.

Resolves #1011
  • Loading branch information
sobychacko committed Mar 9, 2023
1 parent 1de9be0 commit 9e39f2c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.springframework.lang.Nullable;
import org.springframework.messaging.Message;
import org.springframework.messaging.converter.CompositeMessageConverter;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

/**
Expand Down Expand Up @@ -126,8 +127,10 @@ public <T> T lookup(Class<?> type, String functionDefinition, String... expected
.filter(name -> !RoutingFunction.FUNCTION_NAME.equals(name))
.filter(name -> !RoutingFunction.DEFAULT_ROUTE_HANDLER.equals(name))
.collect(Collectors.toList());
logger.warn("Multiple functional beans were found " + functionalBeans + ", thus can't determine default function definition. Please "
if (!CollectionUtils.isEmpty(functionalBeans) && functionalBeans.size() > 1) {
logger.warn("Multiple functional beans were found " + functionalBeans + ", thus can't determine default function definition. Please "
+ "use 'spring.cloud.function.definition' property to explicitly define it. ");
}
}
if (!isFunctionDefinitionEligible(functionDefinition)) {
return null;
Expand Down

0 comments on commit 9e39f2c

Please sign in to comment.