Spring for Apache Kafka 4.2.0, 4.1.3, and 4.0.9 Available

Releases | Soby Chacko | November 19, 2026 | 3 min read | ...

On behalf of the team and everyone who contributed, I'm happy to announce that Spring for Apache Kafka 4.2.0 is available in Maven Central, together with the 4.1.3 and 4.0.9 maintenance releases.

What's new in 4.2

  • Dependencies are upgraded to their latest major/minor versions, including Spring Framework 7.1 and kafka-clients 4.4.0.

The embedded broker of Apache Kafka 4.4.0 requires the kafka-clients test fixtures and BouncyCastle; spring-kafka-test now brings both in transitively.

  • New maxRecoveryFailures option on the DefaultErrorHandler and DefaultAfterRollbackProcessor to stop redelivering a record when its recoverer keeps throwing (for example, when the dead-letter topic is unavailable).
  • New CommonErrorHandler.clearThreadStateFor(Collection<TopicPartition>): after a successful batch, the container clears the retry state only for the partitions in that batch.
  • The DeadLetterPublishingRecoverer checks that the destination partition exists when recovering batch listener records, as it already did for record listeners.
  • The CommonDelegatingErrorHandler supports the KafkaHeaders.DELIVERY_ATTEMPT header.
  • Offsets committed by the container, the error handlers and the DefaultAfterRollbackProcessor include the leader epoch of the record, which allows the consumer to detect log truncation.
  • New awaitAsyncResultsOnStop container property: on stop, the consumer waits up to the shutdownTimeout for in-flight async listener results (CompletableFuture, Mono, Kotlin suspend) and commits their offsets.
  • New spring.kafka.container.start.count and spring.kafka.container.stop.count Micrometer counters.
  • AbstractKafkaListenerContainerFactory.setKafkaAdmin() to apply a KafkaAdmin to every container the factory creates.
  • Batch and non-batch listener observations use the same low-cardinality meter tags, which fixes Prometheus registration failures when both are used in one application.

Existing meter tags change, so dashboards and recording rules may need an update.

  • Share consumers: automatic acquisition lock renewal in ShareAckMode.EXPLICIT (ContainerProperties.setShareAutoRenewLocks(true)), ShareKafkaMessageListenerContainer.getClientInstanceIds() for KIP-714 telemetry, and RecordMessageConverter support on the ShareKafkaListenerContainerFactory.

A new share consumer sample is also available.

See the What's New chapter and the release notes for more information. The 4.2.0-M1, 4.2.0-M2 and 4.2.0-RC1 release notes have the complete history.

4.1.3 and 4.0.9

4.1.3 and 4.0.9 contain bug fixes, CVE fixes and dependency upgrades. Together with 4.1.1, 4.1.2, 4.0.7 and 4.0.8, they bring most of the 4.2 bug fixes to the maintenance lines, including:

  • Records lost during retries with the CommonDelegatingErrorHandler and CommonMixedErrorHandler.
  • Partitions left unconsumed after a cooperative rebalance with async listeners.
  • Offset commits skipped after a consumer wakeup, or committed backwards after a partial batch acknowledgment.
  • Idempotent producers not recreated after an InvalidPidMappingException.
  • Containers that kept running without partitions when the group.instance.id was still in use.

See the release notes for 4.1.3, 4.1.2, 4.1.1, 4.0.9, 4.0.8 and 4.0.7.

CVEs fixed in these releases

These two were fixed earlier, in 4.1.1 and 4.0.7:

Contributors

Thank you to the community members who contributed since 4.1.0:

@29shivam, @arimu1, @beyondwin, @BK202503, @bobby224812, @CCCLL, @cfcromn, @chuuminggg, @COBI-98, @dlwhdgus0810, @dlwldn30, @dongmin132, @GangEunzzang, @Gaurav1112, @hunseonglee, @janwaleed09, @kalayciburak, @kdelay, @kyash99252, @LindseyZ1205, @ngocnhan-tran1996, @nikita-kibitkin, @ohchanKyu, @OmarMorales71, @renechoi, @seungh0, @sharanggupta, @sofiane-benzid, @sudhanshubliz, @VadimPresident, @wldks1008, @wn1331, @wolfpeyton

Project Page | GitHub Issues | Contributing

Get the Spring newsletter

Stay connected with the Spring newsletter

Subscribe

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

TrueSource Spring Enterprise offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all