Search code examples
mongodbspring-bootmavenreactive-programmingspring-data-mongodb

where can I download MongoDb Java Driver 4.0.1 with MongoDB Reactive Streams Driver feature and set Spring Data to use it


Maybe a very naive question but I really can't find it. Honestly I would expect to find it in maven repository but I didn't. At the moment of this question the most recent available version is

maven repository

I looked also at:

github team

and

github documentation

You may wonder why I am interested on version 4 since mongo-java-driver-3.12.2.jar is garanted as compatible with MongoDb 4 (compatibility table). Basically, I am designed a significant Reactive Arquitecture and I am trying my best with Reactive, Non-blocking, Back Pressure control stuck and MongoDb is the main candidate for our private cloud. So I really want to start taking advantage any improvement found in new version.

So my main question is: where is MongoDb Java Driver 4 available. A surrounding question is: is Spring-Data ready to use it? Should I change either something in maven or add manually to my classpath?

The bellow POM brings me both mongo-driver-core and mongo-driver-async version 3.11.2

Pom

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.6.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.reactive</groupId>
    <artifactId>fluxdemo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>fluxdemo</name>
    <description>Projeto parte da arquitetura de referência</description>

    <properties>
        <java.version>11</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

Solution

  • The MongoDB reactive streams driver can be obtained via org.mongodb:mongodb-driver-reactivestreams.

    Spring Data MongoDB 3.0 (to be picked up by Spring Boot 2.3) will add support for the 4.x MongoDB Drivers. Please mind the Upgrading from 2.x section in the reference documentation.