From 66f585a6e5735aedc201a31aa9a790addd6d0dca Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Mon, 4 Dec 2023 11:46:38 -0500 Subject: [PATCH] Gh-2921: Fix bean registration in docs sample Fixes https://github.com/spring-projects/spring-kafka/issues/2921 The `RoutingKafkaTemplate` sample configuration in the `sending-messages.adoc` use an out-dated API for `context.registerBean()` (Or the sample has never been correct) --- .../main/antora/modules/ROOT/pages/kafka/sending-messages.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/sending-messages.adoc b/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/sending-messages.adoc index d5cd0f6773..19a33384bc 100644 --- a/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/sending-messages.adoc +++ b/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/sending-messages.adoc @@ -247,7 +247,7 @@ public class Application { Map configs = new HashMap<>(pf.getConfigurationProperties()); configs.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class); DefaultKafkaProducerFactory bytesPF = new DefaultKafkaProducerFactory<>(configs); - context.registerBean(DefaultKafkaProducerFactory.class, "bytesPF", bytesPF); + context.registerBean("bytesPF", DefaultKafkaProducerFactory.class, () -> bytesPF); Map> map = new LinkedHashMap<>(); map.put(Pattern.compile("two"), bytesPF);