Spring for Apache Kafka 4.0
Last reviewed Sep 11, 2026
Prompt Details
Prompt Composition
3prompts
- Java 25113 lines · 2.8K tokens
- Spring Boot 4.083 lines · 3.7K tokens
- Spring for Apache Kafka 4.062 lines · 3.1K tokens
Total258 lines · 9.7K tokens
CWE Coverage
- 15
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 95
- 117
- 190
- 201
- 208
- 209
- 214
- 250
- 295
- 297
- 306
- 319
- 323
- 327
- 338
- 346
- 347
- 352
- 362
- 367
- 378
- 379
- 409
- 427
- 444
- 470
- 471
- 494
- 502
- 532
- 611
- 613
- 614
- 653
- 681
- 732
- 749
- 770
- 772
- 776
- 789
- 807
- 862
- 863
- 915
- 916
- 918
- 922
- 942
- 1004
- 1275
- 1333
Prompt Preview
Apply the Spring Boot 4.0 baseline first. These rules cover the Spring Kafka 4.0 line at 4.0.7, which builds on Java 17 or later, Spring Framework 7.0.9, and Apache Kafka clients 4.1.2, and which ships both the deprecated Jackson 2 classes and their Jackson 3 replacements.
Line-specific changes
- Decide explicitly whether the application runs on Jackson 2 or Jackson 3: 4.0 prefers Jackson 3 for its default header mapper when it is on the classpath; explicitly configured
JsonDeserializerinstances remain Jackson 2, and both deserializer families use the samespring.json.*property names. - Configure trusted packages, type mappings, and header trust on the classes actually in use —
JacksonJsonSerializer/JacksonJsonDeserializer,JacksonJsonSerde,DefaultJacksonJavaTypeMapper, andJsonKafkaHeaderMapperon Jackson 3; the deprecatedJsonSerializer/JsonDeserializer,JsonSerde,DefaultJackson2JavaTypeMapper, andDefaultKafkaHeaderMapperon Jackson 2. A hardened Jackson 2ObjectMapperdoes not protect a Jackson 3 deserializer. - Treat the ZooKeeper removal as a deployment change, not just a test change: Kafka 4.x brokers and the 4.0 embedded test broker are KRaft-only,
EmbeddedKafkaZKBrokerandEmbeddedKafkaRuleare gone, and@EmbeddedKafkano longer acceptszookeeperPort,zkConnectionTimeout, orzkSessionTimeout, so review KRaft ACL configuration when upgrading the brokers; client upgrades alone do not require a KRaft broker. - Spring Retry is no longer a dependency; retry configuration moved to Spring Framework's
BackOffand Spring