覆盖 Spring Boot 依赖项

在使用 Spring 针对 Apache Pulsar 的 Spring Boot 应用程序中,Apache Pulsar 依赖项版本由 Spring Boot 的依赖项管理确定。 如果你希望使用不同的 pulsar-client-all 版本,需要覆盖 Spring Boot 依赖项管理所使用的版本;设置 pulsar.version 属性。spring-doc.cadn.net.cn

或者,要使用与受支持的 Spring Boot 版本兼容的不同 Spring for Apache Pulsar 版本,请设置 spring-pulsar.version 属性。spring-doc.cadn.net.cn

在以下示例中,正在使用 Pulsar 客户端和 Spring for Apache Pulsar 的快照版本。spring-doc.cadn.net.cn

Gradle
ext['pulsar.version'] = '4.4.2-SNAPSHOT'
ext['spring-pulsar.version'] = '2.0.1-SNAPSHOT'

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-pulsar'
}
<properties>
    <pulsar.version>4.4.2-SNAPSHOT</pulsar.version>
    <spring-pulsar.version>2.0.1-SNAPSHOT</spring-pulsar.version>
</properties>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-pulsar</artifactId>
</dependency>