diff --git a/function/spring-filter-function/README.adoc b/function/spring-filter-function/README.adoc index 2c9917cf..aa110095 100644 --- a/function/spring-filter-function/README.adoc +++ b/function/spring-filter-function/README.adoc @@ -4,7 +4,7 @@ This module provides a filter function that can be reused and composed in other ## Beans for injection -You can import the `FilterFunctionConfiguration` in a Spring Boot application and then inject the following bean. +The `FilterFunctionConfiguration` auto-configuration provides following bean: `filterFunction` diff --git a/function/spring-filter-function/src/main/java/org/springframework/cloud/fn/filter/FilterFunctionConfiguration.java b/function/spring-filter-function/src/main/java/org/springframework/cloud/fn/filter/FilterFunctionConfiguration.java index 23000808..8e754d93 100644 --- a/function/spring-filter-function/src/main/java/org/springframework/cloud/fn/filter/FilterFunctionConfiguration.java +++ b/function/spring-filter-function/src/main/java/org/springframework/cloud/fn/filter/FilterFunctionConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2020 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,8 @@ import org.springframework.messaging.Message; /** + * Auto-configuration for Filter function. + * * @author Artem Bilan * @author David Turanski */ @@ -36,7 +38,7 @@ public class FilterFunctionConfiguration { public Function, Message> filterFunction( ExpressionEvaluatingTransformer filterExpressionEvaluatingTransformer) { - return message -> { + return (message) -> { if ((Boolean) filterExpressionEvaluatingTransformer.transform(message).getPayload()) { return message; } diff --git a/function/spring-filter-function/src/main/java/org/springframework/cloud/fn/filter/package-info.java b/function/spring-filter-function/src/main/java/org/springframework/cloud/fn/filter/package-info.java new file mode 100644 index 00000000..648e5d5c --- /dev/null +++ b/function/spring-filter-function/src/main/java/org/springframework/cloud/fn/filter/package-info.java @@ -0,0 +1,4 @@ +/** + * The Filter function support classes. + */ +package org.springframework.cloud.fn.filter; diff --git a/function/spring-filter-function/src/test/java/org/springframework/cloud/fn/filter/FilterFunctionApplicationTests.java b/function/spring-filter-function/src/test/java/org/springframework/cloud/fn/filter/FilterFunctionApplicationTests.java index bd1e7e20..5edd699f 100644 --- a/function/spring-filter-function/src/test/java/org/springframework/cloud/fn/filter/FilterFunctionApplicationTests.java +++ b/function/spring-filter-function/src/test/java/org/springframework/cloud/fn/filter/FilterFunctionApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2020 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import java.util.List; import java.util.function.Function; -import java.util.stream.Collectors; import java.util.stream.Stream; import org.junit.jupiter.api.Test; @@ -47,9 +46,8 @@ public class FilterFunctionApplicationTests { @Test public void testFilter() { - Stream> messages = List.of("hello", "hello world").stream().map(GenericMessage::new); - List> result = messages.filter(message -> this.filter.apply(message) != null) - .collect(Collectors.toList()); + Stream> messages = Stream.of("hello", "hello world").map(GenericMessage::new); + List> result = messages.filter((message) -> this.filter.apply(message) != null).toList(); assertThat(result.size()).isEqualTo(1); assertThat(result.get(0).getPayload()).isNotNull(); assertThat(result.get(0).getPayload()).isEqualTo("hello world"); diff --git a/function/spring-payload-converter-function/src/main/java/functions/ByteArrayTextToString.java b/function/spring-payload-converter-function/src/main/java/functions/ByteArrayTextToString.java index 352fcc2a..a1478464 100644 --- a/function/spring-payload-converter-function/src/main/java/functions/ByteArrayTextToString.java +++ b/function/spring-payload-converter-function/src/main/java/functions/ByteArrayTextToString.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2020 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,8 @@ import org.springframework.util.MimeTypeUtils; /** + * The function which transforms a byte array to string. + * * @author Christian Tzolov */ public class ByteArrayTextToString implements Function, Message> { diff --git a/function/spring-payload-converter-function/src/main/java/functions/package-info.java b/function/spring-payload-converter-function/src/main/java/functions/package-info.java new file mode 100644 index 00000000..bfb28672 --- /dev/null +++ b/function/spring-payload-converter-function/src/main/java/functions/package-info.java @@ -0,0 +1,4 @@ +/** + * The utility functions for common usage. + */ +package functions; diff --git a/function/spring-spel-function/README.adoc b/function/spring-spel-function/README.adoc index 0545d1d5..cbb26178 100644 --- a/function/spring-spel-function/README.adoc +++ b/function/spring-spel-function/README.adoc @@ -5,7 +5,7 @@ The function can be used to apply SpEL transformations on data based on a SpEL e ## Beans for injection -You can import the `SpelFunctionConfiguration` in a Spring Boot application and then inject the following bean. +The `SpelFunctionConfiguration` auto-configuration provides the following bean: `spelFunction` diff --git a/function/spring-spel-function/src/main/java/org/springframework/cloud/fn/spel/SpelFunctionConfiguration.java b/function/spring-spel-function/src/main/java/org/springframework/cloud/fn/spel/SpelFunctionConfiguration.java index cb35ef78..9406e437 100644 --- a/function/spring-spel-function/src/main/java/org/springframework/cloud/fn/spel/SpelFunctionConfiguration.java +++ b/function/spring-spel-function/src/main/java/org/springframework/cloud/fn/spel/SpelFunctionConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2020 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,14 +18,18 @@ import java.util.function.Function; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.integration.transformer.ExpressionEvaluatingTransformer; import org.springframework.messaging.Message; -@Configuration +/** + * Auto-configuration for SpEL function. + * + * @author Soby Chacko + */ +@AutoConfiguration @EnableConfigurationProperties(SpelFunctionProperties.class) public class SpelFunctionConfiguration { @@ -33,15 +37,14 @@ public class SpelFunctionConfiguration { public Function, Message> spelFunction( ExpressionEvaluatingTransformer expressionEvaluatingTransformer) { - return message -> expressionEvaluatingTransformer.transform(message); + return expressionEvaluatingTransformer::transform; } @Bean public ExpressionEvaluatingTransformer expressionEvaluatingTransformer( SpelFunctionProperties spelFunctionProperties) { - return new ExpressionEvaluatingTransformer( - new SpelExpressionParser().parseExpression(spelFunctionProperties.getExpression())); + return new ExpressionEvaluatingTransformer(spelFunctionProperties.getExpression()); } } diff --git a/function/spring-spel-function/src/main/java/org/springframework/cloud/fn/spel/SpelFunctionProperties.java b/function/spring-spel-function/src/main/java/org/springframework/cloud/fn/spel/SpelFunctionProperties.java index 36ba3da9..cd44c53c 100644 --- a/function/spring-spel-function/src/main/java/org/springframework/cloud/fn/spel/SpelFunctionProperties.java +++ b/function/spring-spel-function/src/main/java/org/springframework/cloud/fn/spel/SpelFunctionProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2020 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,8 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.expression.Expression; -import org.springframework.expression.spel.standard.SpelExpressionParser; +import org.springframework.integration.expression.FunctionExpression; +import org.springframework.messaging.Message; /** * Configuration properties for the SpEL function. @@ -29,18 +30,18 @@ @ConfigurationProperties("spel.function") public class SpelFunctionProperties { - private static final Expression DEFAULT_EXPRESSION = new SpelExpressionParser().parseExpression("payload"); + private static final Expression DEFAULT_EXPRESSION = new FunctionExpression>(Message::getPayload); /** * A SpEL expression to apply. */ - private String expression = DEFAULT_EXPRESSION.getExpressionString(); + private Expression expression = DEFAULT_EXPRESSION; - public String getExpression() { + public Expression getExpression() { return this.expression; } - public void setExpression(String expression) { + public void setExpression(Expression expression) { this.expression = expression; } diff --git a/function/spring-spel-function/src/main/java/org/springframework/cloud/fn/spel/package-info.java b/function/spring-spel-function/src/main/java/org/springframework/cloud/fn/spel/package-info.java new file mode 100644 index 00000000..158f3f96 --- /dev/null +++ b/function/spring-spel-function/src/main/java/org/springframework/cloud/fn/spel/package-info.java @@ -0,0 +1,4 @@ +/** + * The SpEL function auto-configuration support. + */ +package org.springframework.cloud.fn.spel; diff --git a/function/spring-task-launch-request-function/README.adoc b/function/spring-task-launch-request-function/README.adoc index c3e8b65e..0e9a4979 100644 --- a/function/spring-task-launch-request-function/README.adoc +++ b/function/spring-task-launch-request-function/README.adoc @@ -1,11 +1,11 @@ # Task Launch Request Function This module provides a function that can be reused and composed in other applications to transform the output to a link:src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequest.java[TaskLaunchRequest] -that can be used as input to the Tasklauncher function to launch a task. +that can be used as input to the TaskLauncher function to launch a task. ## Beans for injection -You can import the `TaskLaunchRequestFunctionConfiguration` in a Spring Boot application and then inject the following bean. +The `TaskLaunchRequestFunctionConfiguration` auto-configuration provides the following bean: `taskLaunchRequestFunction` as a link:src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestFunction.java[TaskLaunchRequestFunction]. diff --git a/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestFunctionConfiguration.java b/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestFunctionConfiguration.java index 4585aa18..740944d6 100644 --- a/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestFunctionConfiguration.java +++ b/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestFunctionConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2020 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,14 +23,14 @@ import java.util.List; import java.util.Map; -import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; import org.springframework.expression.spel.standard.SpelExpressionParser; -import org.springframework.integration.expression.ExpressionUtils; +import org.springframework.integration.context.IntegrationContextUtils; import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.util.StringUtils; @@ -40,11 +40,11 @@ * that can be composed with other Suppliers or Functions to transform any {@link Message} * to a {@link TaskLaunchRequest} which may be used as input to the * {@code TaskLauncherFunction} to launch a task. - * + *

* Command line arguments used by the task, as well as the task name itself may be * statically configured or extracted from the message contents, using SpEL. See * {@link TaskLaunchRequestFunctionProperties} for details. - * + *

* It is also possible to provide your own implementations of * {@link CommandLineArgumentsMessageMapper} and {@link TaskNameMessageMapper}. * @@ -57,7 +57,7 @@ public class TaskLaunchRequestFunctionConfiguration { /** * The function name. */ - public final static String TASK_LAUNCH_REQUEST_FUNCTION_NAME = "taskLaunchRequestFunction"; + public static final String TASK_LAUNCH_REQUEST_FUNCTION_NAME = "taskLaunchRequestFunction"; /** * A {@link java.util.function.Function} to transform a {@link Message} payload to a @@ -67,22 +67,24 @@ public class TaskLaunchRequestFunctionConfiguration { * @return a {@code TaskLaunchRequest} Message. */ @Bean(name = TASK_LAUNCH_REQUEST_FUNCTION_NAME) - public TaskLaunchRequestFunction taskLaunchRequest( - TaskLaunchRequestMessageProcessor taskLaunchRequestMessageProcessor) { - return message -> taskLaunchRequestMessageProcessor.postProcessMessage(message); + TaskLaunchRequestFunction taskLaunchRequest(TaskLaunchRequestMessageProcessor taskLaunchRequestMessageProcessor) { + + return taskLaunchRequestMessageProcessor::postProcessMessage; } @Bean - public TaskLaunchRequestSupplier taskLaunchRequestInitializer( + TaskLaunchRequestSupplier taskLaunchRequestInitializer( TaskLaunchRequestFunctionProperties taskLaunchRequestProperties) { + return new TaskLaunchRequestPropertiesInitializer(taskLaunchRequestProperties); } @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") @Bean - public TaskLaunchRequestMessageProcessor taskLaunchRequestMessageProcessor( + TaskLaunchRequestMessageProcessor taskLaunchRequestMessageProcessor( TaskLaunchRequestSupplier taskLaunchRequestInitializer, TaskLaunchRequestFunctionProperties properties, - EvaluationContext evaluationContext, @Nullable TaskNameMessageMapper taskNameMessageMapper, + @Qualifier(IntegrationContextUtils.INTEGRATION_EVALUATION_CONTEXT_BEAN_NAME) EvaluationContext evaluationContext, + @Nullable TaskNameMessageMapper taskNameMessageMapper, @Nullable CommandLineArgumentsMessageMapper commandLineArgumentsMessageMapper) { if (taskNameMessageMapper == null) { @@ -97,13 +99,9 @@ public TaskLaunchRequestMessageProcessor taskLaunchRequestMessageProcessor( commandLineArgumentsMessageMapper); } - @Bean - public EvaluationContext evaluationContext(BeanFactory beanFactory) { - return ExpressionUtils.createStandardEvaluationContext(beanFactory); - } - private TaskNameMessageMapper taskNameMessageMapper(TaskLaunchRequestFunctionProperties taskLaunchRequestProperties, EvaluationContext evaluationContext) { + if (StringUtils.hasText(taskLaunchRequestProperties.getTaskNameExpression())) { SpelExpressionParser expressionParser = new SpelExpressionParser(); Expression taskNameExpression = expressionParser @@ -111,12 +109,13 @@ private TaskNameMessageMapper taskNameMessageMapper(TaskLaunchRequestFunctionPro return new ExpressionEvaluatingTaskNameMessageMapper(taskNameExpression, evaluationContext); } - return message -> taskLaunchRequestProperties.getTaskName(); + return (message) -> taskLaunchRequestProperties.getTaskName(); } private CommandLineArgumentsMessageMapper commandLineArgumentsMessageMapper( TaskLaunchRequestFunctionProperties taskLaunchRequestFunctionProperties, EvaluationContext evaluationContext) { + return new ExpressionEvaluatingCommandLineArgsMapper(taskLaunchRequestFunctionProperties.getArgExpressions(), evaluationContext); } @@ -130,25 +129,17 @@ private static class TaskLaunchRequestPropertiesInitializer extends TaskLaunchRe this.deploymentPropertiesSupplier(() -> KeyValueListParser .parseCommaDelimitedKeyValuePairs(taskLaunchRequestProperties.getDeploymentProperties())); - this.taskNameSupplier(() -> taskLaunchRequestProperties.getTaskName()); + this.taskNameSupplier(taskLaunchRequestProperties::getTaskName); } } - private static class ExpressionEvaluatingTaskNameMessageMapper implements TaskNameMessageMapper { - - private final Expression expression; - - private final EvaluationContext evaluationContext; - - ExpressionEvaluatingTaskNameMessageMapper(Expression expression, EvaluationContext evaluationContext) { - this.evaluationContext = evaluationContext; - this.expression = expression; - } + private record ExpressionEvaluatingTaskNameMessageMapper(Expression expression, + EvaluationContext evaluationContext) implements TaskNameMessageMapper { @Override public String processMessage(Message message) { - return expression.getValue(evaluationContext, message).toString(); + return this.expression.getValue(this.evaluationContext, message).toString(); } } @@ -166,7 +157,7 @@ private static class ExpressionEvaluatingCommandLineArgsMapper implements Comman SpelExpressionParser expressionParser = new SpelExpressionParser(); KeyValueListParser.parseCommaDelimitedKeyValuePairs(argExpressions) - .forEach((k, v) -> argExpressionsMap.put(k, expressionParser.parseExpression(v))); + .forEach((k, v) -> this.argExpressionsMap.put(k, expressionParser.parseExpression(v))); } } diff --git a/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestFunctionProperties.java b/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestFunctionProperties.java index dd27c919..1ff4b715 100644 --- a/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestFunctionProperties.java +++ b/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestFunctionProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2020 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,7 +82,7 @@ public void setDeploymentProperties(String deploymentProperties) { } public String getTaskName() { - return taskName; + return this.taskName; } public void setTaskName(String taskName) { @@ -90,7 +90,7 @@ public void setTaskName(String taskName) { } public String getTaskNameExpression() { - return taskNameExpression; + return this.taskNameExpression; } public void setTaskNameExpression(String taskNameExpression) { @@ -98,7 +98,7 @@ public void setTaskNameExpression(String taskNameExpression) { } public String getArgExpressions() { - return argExpressions; + return this.argExpressions; } public void setArgExpressions(String argExpressions) { diff --git a/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestMessageProcessor.java b/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestMessageProcessor.java index eb649b9f..6923425a 100644 --- a/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestMessageProcessor.java +++ b/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestMessageProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2020 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,22 +46,22 @@ class TaskLaunchRequestMessageProcessor implements MessagePostProcessor { @Override public Message postProcessMessage(Message message) { - TaskLaunchRequest taskLaunchRequest = taskLaunchRequestInitializer.get(); + TaskLaunchRequest taskLaunchRequest = this.taskLaunchRequestInitializer.get(); if (!StringUtils.hasText(taskLaunchRequest.getTaskName())) { - taskLaunchRequest.setTaskName(taskNameMessageMapper.processMessage(message)); + taskLaunchRequest.setTaskName(this.taskNameMessageMapper.processMessage(message)); Assert.hasText(taskLaunchRequest.getTaskName(), () -> "'taskName' is required in " + TaskLaunchRequest.class.getName()); } - taskLaunchRequest.addCommmandLineArguments(commandLineArgumentsMessageMapper.processMessage(message)); + taskLaunchRequest.addCommmandLineArguments(this.commandLineArgumentsMessageMapper.processMessage(message)); MessageBuilder builder = MessageBuilder.withPayload(taskLaunchRequest) .copyHeaders(message.getHeaders()); return adjustHeaders(builder).build(); } - private MessageBuilder adjustHeaders(MessageBuilder builder) { + private static MessageBuilder adjustHeaders(MessageBuilder builder) { builder.setHeader(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.APPLICATION_JSON); return builder; } diff --git a/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestSupplier.java b/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestSupplier.java index 3775c89c..494ed351 100644 --- a/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestSupplier.java +++ b/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestSupplier.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2020 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,18 +30,18 @@ class TaskLaunchRequestSupplier implements Supplier { private Supplier> deploymentPropertiesSupplier; - public TaskLaunchRequestSupplier taskNameSupplier(Supplier taskNameSupplier) { + TaskLaunchRequestSupplier taskNameSupplier(Supplier taskNameSupplier) { this.taskNameSupplier = taskNameSupplier; return this; } - public TaskLaunchRequestSupplier commandLineArgumentSupplier(Supplier> commandLineArgumentsSupplier) { + TaskLaunchRequestSupplier commandLineArgumentSupplier(Supplier> commandLineArgumentsSupplier) { this.commandLineArgumentsSupplier = commandLineArgumentsSupplier; return this; } - public TaskLaunchRequestSupplier deploymentPropertiesSupplier( - Supplier> deploymentPropertiesSupplier) { + TaskLaunchRequestSupplier deploymentPropertiesSupplier(Supplier> deploymentPropertiesSupplier) { + this.deploymentPropertiesSupplier = deploymentPropertiesSupplier; return this; } diff --git a/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/package-info.java b/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/package-info.java new file mode 100644 index 00000000..fb1c642a --- /dev/null +++ b/function/spring-task-launch-request-function/src/main/java/org/springframework/cloud/fn/task/launch/request/package-info.java @@ -0,0 +1,4 @@ +/** + * The Task Launcher function auto-configuration support. + */ +package org.springframework.cloud.fn.task.launch.request; diff --git a/function/spring-task-launch-request-function/src/test/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestFunctionApplicationTests.java b/function/spring-task-launch-request-function/src/test/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestFunctionApplicationTests.java index d548216a..123387ab 100644 --- a/function/spring-task-launch-request-function/src/test/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestFunctionApplicationTests.java +++ b/function/spring-task-launch-request-function/src/test/java/org/springframework/cloud/fn/task/launch/request/TaskLaunchRequestFunctionApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2020 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -194,13 +194,13 @@ protected static class TaskLaunchRequestFunctionTestApplication { @Bean @ConditionalOnProperty("customTaskNameExtractor") TaskNameMessageMapper taskNameExtractor() { - return message -> ((String) (message.getPayload())).equalsIgnoreCase("foo") ? "fooTask" : "defaultTask"; + return (message) -> ((String) (message.getPayload())).equalsIgnoreCase("foo") ? "fooTask" : "defaultTask"; } @Bean @ConditionalOnProperty("enhanceTLRArgs") CommandLineArgumentsMessageMapper commandLineArgumentsProvider() { - return message -> Collections.singletonList("runtimeArg"); + return (message) -> Collections.singletonList("runtimeArg"); } }