From 9b1754bdcadcb6355f677003763049b6e6b611c5 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Thu, 19 Dec 2024 13:38:17 -0500 Subject: [PATCH] GH-118: Fix auto-wire ambiguity in the `HttpSupplierConfiguration` Fixes: https://github.com/spring-cloud/spring-functions-catalog/issues/118 * Use `toReactivePublisher(true)` instead of manual lifecycle control for the `WebFluxInboundEndpoint` --- .../fn/supplier/http/HttpSupplierConfiguration.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/supplier/spring-http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSupplierConfiguration.java b/supplier/spring-http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSupplierConfiguration.java index 77978dbc..228c3eb4 100644 --- a/supplier/spring-http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSupplierConfiguration.java +++ b/supplier/spring-http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSupplierConfiguration.java @@ -68,23 +68,18 @@ public class HttpSupplierConfiguration { .codecConfigurer(serverCodecConfigurer) .crossOrigin((crossOrigin) -> crossOrigin.origin(httpSupplierProperties.getCors().getAllowedOrigins()) .allowedHeaders(httpSupplierProperties.getCors().getAllowedHeaders()) - .allowCredentials(httpSupplierProperties.getCors().getAllowCredentials())) - .autoStartup(false)) + .allowCredentials(httpSupplierProperties.getCors().getAllowCredentials()))) .enrichHeaders((headers) -> headers.headerFunction(MessageHeaders.CONTENT_TYPE, (message) -> (MediaType.APPLICATION_FORM_URLENCODED .equals(message.getHeaders().get(MessageHeaders.CONTENT_TYPE, MediaType.class))) ? MediaType.APPLICATION_JSON : null, true)) - .toReactivePublisher(); + .toReactivePublisher(true); } @Bean - public Supplier>> httpSupplier(Publisher> httpRequestPublisher, - WebFluxInboundEndpoint webFluxInboundEndpoint) { - - return () -> Flux.from(httpRequestPublisher) - .doOnSubscribe((subscription) -> webFluxInboundEndpoint.start()) - .doOnTerminate(webFluxInboundEndpoint::stop); + public Supplier>> httpSupplier(Publisher> httpSupplierFlow) { + return () -> Flux.from(httpSupplierFlow); } }