From 03067496dcf63d877228ea24aa4f5c73e48d396c Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Thu, 19 Dec 2024 12:29:00 -0500 Subject: [PATCH] GH-114: Fix `TcpConsumerConfiguration` for auto-wire ambiguity Fixes: https://github.com/spring-cloud/spring-functions-catalog/issues/114 --- .../fn/consumer/tcp/TcpConsumerConfiguration.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/consumer/spring-tcp-consumer/src/main/java/org/springframework/cloud/fn/consumer/tcp/TcpConsumerConfiguration.java b/consumer/spring-tcp-consumer/src/main/java/org/springframework/cloud/fn/consumer/tcp/TcpConsumerConfiguration.java index 7b1933e7..58da8e9f 100644 --- a/consumer/spring-tcp-consumer/src/main/java/org/springframework/cloud/fn/consumer/tcp/TcpConsumerConfiguration.java +++ b/consumer/spring-tcp-consumer/src/main/java/org/springframework/cloud/fn/consumer/tcp/TcpConsumerConfiguration.java @@ -38,14 +38,15 @@ import org.springframework.messaging.Message; * @author Gary Russell * @author Christian Tzolov * @author Chris Bono + * @author Artem Bilan */ @AutoConfiguration @EnableConfigurationProperties({ TcpConsumerProperties.class, TcpConnectionFactoryProperties.class }) public class TcpConsumerConfiguration { - private TcpConsumerProperties properties; + private final TcpConsumerProperties properties; - private TcpConnectionFactoryProperties tcpConnectionProperties; + private final TcpConnectionFactoryProperties tcpConnectionProperties; public TcpConsumerConfiguration(TcpConsumerProperties properties, TcpConnectionFactoryProperties tcpConnectionProperties) { @@ -55,12 +56,12 @@ public class TcpConsumerConfiguration { } @Bean - public Consumer> tcpConsumer(TcpSendingMessageHandlerSmartLifeCycle handler) { - return handler::handleMessage; + public Consumer> tcpConsumer(TcpSendingMessageHandler tcpConsumerMessageHandler) { + return tcpConsumerMessageHandler::handleMessage; } @Bean - public TcpSendingMessageHandlerSmartLifeCycle handler( + public TcpSendingMessageHandler tcpConsumerMessageHandler( @Qualifier("tcpSinkConnectionFactory") AbstractConnectionFactory connectionFactory) { TcpSendingMessageHandlerSmartLifeCycle tcpMessageHandler = new TcpSendingMessageHandlerSmartLifeCycle();