咨询:Spring Integration Kafka是否有可用的BOM依赖?
Great question! You're right that in older versions of Spring Integration (like the one paired with Spring Boot 2.0.1.RELEASE), spring-integration-kafka isn't included in the core Spring Integration BOM. That said, there is a dedicated BOM for Spring Integration Kafka that you can import to avoid manually specifying versions.
Here's how to update your Gradle configuration:
First, add the Spring Integration Kafka BOM to your dependencyManagement imports. Make sure the BOM version matches the one compatible with your Spring Boot version—for Spring Boot 2.0.1.RELEASE, the corresponding Spring Integration Kafka version is 2.0.1.RELEASE:
plugins { id 'org.springframework.boot' version '2.0.1.RELEASE' id 'io.spring.dependency-management' version '1.0.5.RELEASE' } dependencyManagement { imports { // Import the Spring Integration Kafka BOM mavenBom 'org.springframework.integration:spring-integration-kafka-bom:2.0.1.RELEASE' } } dependencies { // Now you can declare the dependency without a version implementation 'org.springframework.integration:spring-integration-kafka' }
A quick note on version compatibility:
If you're unsure which BOM version to use, check the Spring Boot official documentation for the compatible Spring Integration Kafka version paired with your Spring Boot release. This ensures all your integration components work together seamlessly.
If no BOM is available (though unlikely here):
In rare cases where a dedicated BOM doesn't exist, you could also explicitly define the version in the dependencyManagement block instead:
dependencyManagement { dependencies { dependency 'org.springframework.integration:spring-integration-kafka:2.0.1.RELEASE' } }
But using the BOM is the cleaner approach as it centralizes version control for all related Kafka integration artifacts.
内容的提问来源于stack exchange,提问作者mrusinak

