Set the Pulsar and Netty Versions in Spring Boot

Spring Boot’s dependency management includes a version of the Pulsar dependencies that is older than the Pulsar 5.0.x client that Apache Pulsar support for Spring requires. Spring Boot applications must therefore always set the pulsar.version property. It’s also recommended to set the netty.version property to the most recent 4.2.x release of Netty, which is 4.2.20.Final at the time of this release.

Spring Boot does not manage the version of Apache Pulsar support for Spring, so you always declare it on the pulsar-spring-boot-starter dependency.

Gradle

With the Spring Dependency Management plugin, set the properties in gradle.properties:

pulsar.version=5.0.1
netty.version=4.2.20.Final

Alternatively, set them in the build script:

ext['pulsar.version'] = '5.0.1'
ext['netty.version'] = '4.2.20.Final'

dependencies {
    implementation 'org.apache.pulsar:pulsar-spring-boot-starter:3.0.0-M1'
}

Maven

With spring-boot-starter-parent as the parent, set the properties in the POM:

<properties>
    <pulsar.version>5.0.1</pulsar.version>
    <netty.version>4.2.20.Final</netty.version>
</properties>

<dependency>
    <groupId>org.apache.pulsar</groupId>
    <artifactId>pulsar-spring-boot-starter</artifactId>
    <version>3.0.0-M1</version>
</dependency>

Alternatively, set them in the .mvn/maven.config file:

-Dpulsar.version=5.0.1
-Dnetty.version=4.2.20.Final

The properties have no effect when you import spring-boot-dependencies rather than use the parent. In that case, import pulsar-bom and netty-bom before it:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.apache.pulsar</groupId>
            <artifactId>pulsar-bom</artifactId>
            <version>5.0.1</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-bom</artifactId>
            <version>4.2.20.Final</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>4.1.2</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>