覆盖 Spring Boot 依赖
当在 Spring Boot 应用程序中使用 Spring for Apache Pulsar 时,Apache Pulsar 依赖版本由 Spring Boot 的依赖管理决定。 如果您希望使用不同版本的 pulsar-client-all
或 pulsar-client-reactive-adapter
,您需要覆盖 Spring Boot 依赖管理使用的版本;分别设置 pulsar.version
或 pulsar-reactive.version
属性。
或者,要将不同版本的 Spring for Apache Pulsar 与受支持的 Spring Boot 版本一起使用,请设置 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>