Skip to content

Verify Ineligible Functions Before Logging Warnings #1240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
BohdanKorinnyi opened this issue Feb 28, 2025 · 0 comments
Closed

Verify Ineligible Functions Before Logging Warnings #1240

BohdanKorinnyi opened this issue Feb 28, 2025 · 0 comments

Comments

@BohdanKorinnyi
Copy link

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.

@olegz olegz added this to the 4.3 milestone Mar 20, 2025
@olegz olegz closed this as completed in 96e16cc Mar 20, 2025
olegz added a commit that referenced this issue Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants