diff --git a/function/filter-function/src/main/resources/META-INF/spring.factories b/function/filter-function/src/main/resources/META-INF/spring.factories new file mode 100644 index 00000000..4823a19e --- /dev/null +++ b/function/filter-function/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ + org.springframework.cloud.fn.filter.FilterFunctionConfiguration diff --git a/function/header-enricher-function/src/main/java/org/springframework/cloud/fn/header/enricher/HeaderEnricherFunctionConfiguration.java b/function/header-enricher-function/src/main/java/org/springframework/cloud/fn/header/enricher/HeaderEnricherFunctionConfiguration.java index afb025e3..85c8eedf 100644 --- a/function/header-enricher-function/src/main/java/org/springframework/cloud/fn/header/enricher/HeaderEnricherFunctionConfiguration.java +++ b/function/header-enricher-function/src/main/java/org/springframework/cloud/fn/header/enricher/HeaderEnricherFunctionConfiguration.java @@ -24,6 +24,7 @@ import java.util.function.Function; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -39,6 +40,7 @@ import org.springframework.messaging.Message; */ @Configuration @EnableConfigurationProperties(HeaderEnricherFunctionProperties.class) +@ConditionalOnProperty(prefix = "header.enricher", value = "headers") public class HeaderEnricherFunctionConfiguration { @Autowired diff --git a/function/header-enricher-function/src/main/java/org/springframework/cloud/fn/header/enricher/HeaderEnricherFunctionProperties.java b/function/header-enricher-function/src/main/java/org/springframework/cloud/fn/header/enricher/HeaderEnricherFunctionProperties.java index 2b24cf6a..d6681897 100644 --- a/function/header-enricher-function/src/main/java/org/springframework/cloud/fn/header/enricher/HeaderEnricherFunctionProperties.java +++ b/function/header-enricher-function/src/main/java/org/springframework/cloud/fn/header/enricher/HeaderEnricherFunctionProperties.java @@ -16,7 +16,6 @@ package org.springframework.cloud.fn.header.enricher; - import java.util.Properties; import javax.validation.constraints.NotNull; @@ -36,13 +35,13 @@ import org.springframework.validation.annotation.Validated; public class HeaderEnricherFunctionProperties { /** - * \n separated properties representing headers in which values are SpEL expressions, - * e.g foo='bar' \n baz=payload.baz. + * \n separated properties representing headers in which values are SpEL expressions, e.g + * foo='bar' \n baz=payload.baz. */ private Properties headers; /** - * set to true to overwrite any existing message headers. + * set to true to overwrite any existing message headers. */ private boolean overwrite = false; diff --git a/function/header-enricher-function/src/main/resources/META-INF/spring.factories b/function/header-enricher-function/src/main/resources/META-INF/spring.factories new file mode 100644 index 00000000..15c09a96 --- /dev/null +++ b/function/header-enricher-function/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ + org.springframework.cloud.fn.header.enricher.HeaderEnricherFunctionConfiguration diff --git a/function/payload-converter-function/src/main/java/functions/ToMessage.java b/function/payload-converter-function/src/main/java/functions/ToMessage.java new file mode 100644 index 00000000..f0d80a26 --- /dev/null +++ b/function/payload-converter-function/src/main/java/functions/ToMessage.java @@ -0,0 +1,35 @@ +/* + * Copyright 2020-2020 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package functions; + +import java.util.function.Function; + +import org.springframework.messaging.Message; +import org.springframework.messaging.support.MessageBuilder; + +/** + * Wrap a POJO as a message. + * + */ +// TODO: Remove when https://github.com/spring-cloud/spring-cloud-function/issues/550 is +// resolved. +public class ToMessage implements Function> { + @Override + public Message apply(Object o) { + return MessageBuilder.withPayload(o).build(); + } +} diff --git a/function/spel-function/src/main/resources/META-INF/spring.factories b/function/spel-function/src/main/resources/META-INF/spring.factories new file mode 100644 index 00000000..3c101209 --- /dev/null +++ b/function/spel-function/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ + org.springframework.cloud.fn.spel.SpelFunctionConfiguration diff --git a/function/splitter-function/src/main/resources/META-INF/spring.factories b/function/splitter-function/src/main/resources/META-INF/spring.factories new file mode 100644 index 00000000..cf51183f --- /dev/null +++ b/function/splitter-function/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ + org.springframework.cloud.fn.splitter.SplitterFunctionConfiguration diff --git a/function/task-launch-request-function/src/main/resources/META-INF/spring.factories b/function/task-launch-request-function/src/main/resources/META-INF/spring.factories new file mode 100644 index 00000000..15653c2d --- /dev/null +++ b/function/task-launch-request-function/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ + org.springframework.cloud.fn.task.launch.request.TaskLaunchRequestFunctionConfiguration