Skip to content

Commit e1b0dcd

Browse files
committed
Refactor ackMode configuration to use JavaUtils pattern
Replace explicit null check and manual ackMode setting with the JavaUtils.acceptIfNotNull() pattern for consistency with other property configurations in the initializeContainer method. This improves code readability and maintains a uniform style throughout the property initialization logic. Signed-off-by: gobeomjun <alap_u@naver.com>
1 parent b791695 commit e1b0dcd

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

spring-kafka/src/main/java/org/springframework/kafka/config/AbstractKafkaListenerContainerFactory.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,9 @@ else if (this.autoStartup != null) {
456456
.acceptIfHasText(endpoint.getClientIdPrefix(), instance.getContainerProperties()::setClientId)
457457
.acceptIfNotNull(endpoint.getConsumerProperties(),
458458
instance.getContainerProperties()::setKafkaConsumerProperties)
459-
.acceptIfNotNull(endpoint.getListenerInfo(), instance::setListenerInfo);
460-
461-
// Set ackMode if specified in endpoint (overrides factory default)
462-
String ackMode = endpoint.getAckMode();
463-
if (ackMode != null) {
464-
properties.setAckMode(ContainerProperties.AckMode.valueOf(ackMode.toUpperCase()));
465-
}
459+
.acceptIfNotNull(endpoint.getListenerInfo(), instance::setListenerInfo)
460+
.acceptIfNotNull(endpoint.getAckMode(), ackMode ->
461+
properties.setAckMode(ContainerProperties.AckMode.valueOf(ackMode.toUpperCase())));
466462
}
467463

468464
@Override

0 commit comments

Comments
 (0)