覆寫 Spring Boot 相依性

當在 Spring Boot 應用程式中使用 Spring for Apache Pulsar 時,Apache Pulsar 相依性版本由 Spring Boot 的相依性管理決定。如果您希望使用不同版本的 pulsar-client-allpulsar-client-reactive-adapter,您需要覆寫 Spring Boot 相依性管理使用的版本;分別設定 pulsar.versionpulsar-reactive.version 屬性。

或者,若要搭配支援的 Spring Boot 版本使用不同版本的 Spring for Apache Pulsar,請設定 spring-pulsar.version 屬性。

在以下範例中,正在使用 Pulsar 用戶端和 Spring for Apache Pulsar 的快照版本。

Gradle
ext['pulsar.version'] = '3.1.2-SNAPSHOT'
ext['pulsar-reactive.version'] = '0.5.1-SNAPSHOT'
ext['spring-pulsar.version'] = '1.0.2-SNAPSHOT'

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-pulsar-reactive'
}
  • Maven

<properties>
    <pulsar.version>3.1.2-SNAPSHOT</pulsar.version>
    <pulsar-reactive.version>0.5.1-SNAPSHOT</pulsar-reactive.version>
    <spring-pulsar.version>1.0.2-SNAPSHOT</spring-pulsar.version>
</properties>

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