Skip to content

Verify Ineligible Functions Before Logging Warnings #1240

Closed
@BohdanKorinnyi

Description

@BohdanKorinnyi

Currently, a warning is logged when more than one functional bean is detected. The suggestion is to first check if the function is listed in the ineligible properties and, if so, skip the verification before logging the warning.

		if (!StringUtils.hasText(functionDefinition)) {
			Collection<Object> functionalBeans = this.getNames(null).stream()
					.filter(name -> !RoutingFunction.FUNCTION_NAME.equals(name))
					.filter(name -> !RoutingFunction.DEFAULT_ROUTE_HANDLER.equals(name))
					.collect(Collectors.toList());
			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;
		}

Suggestion is to move block above block with warning log.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions