From eec711cc842e0f6e63bfd076bb042259416a05ee Mon Sep 17 00:00:00 2001 From: ChickenchickenLove Date: Tue, 29 Apr 2025 21:54:10 +0900 Subject: [PATCH] GH-3807: Doc about `@KafkaHandler` requirements Fixes: #3807 Signed-off-by: chickenchickenlove --- .../kafka/receiving-messages/class-level-kafkalistener.adoc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/receiving-messages/class-level-kafkalistener.adoc b/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/receiving-messages/class-level-kafkalistener.adoc index 757ef8ea..3fdf0261 100644 --- a/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/receiving-messages/class-level-kafkalistener.adoc +++ b/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/receiving-messages/class-level-kafkalistener.adoc @@ -2,6 +2,10 @@ = `@KafkaListener` on a Class When you use `@KafkaListener` at the class-level, you must specify `@KafkaHandler` at the method level. +If no `@KafkaHandler` on any methods of this class or its sub-classes, the framework will reject such a configuration. +The `@KafkaHandler` annotation is required for explicit and concise purpose of the method. +Otherwise it is hard to make a decision about this or other method without extra restrictions. + When messages are delivered, the converted message payload type is used to determine which method to call. The following example shows how to do so: @@ -58,4 +62,3 @@ void listen(Object in, @Header(KafkaHeaders.RECORD_METADATA) ConsumerRecordMetad ... } ---- -