How can I specify the spring-data-mongodb version using spring-boot?

I want to use the latest spring-data-mongodb to use the full-text search feature, but I don't know how I can specify this using spring-boot-starter-data-mongodb dependency.

You can read here: maven repository that spring-data-mongodb version is not specified.

This is my pom file:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.1.6.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>

<dependencies>
    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <scope>provided</scope>
    </dependency>
    <!-- Spring Boot -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <!-- Spring Boot Rest -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-rest</artifactId>
    </dependency>
    <!-- Spring Boot Test -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <!-- Spring MongoDB integration -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-mongodb</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-freemarker</artifactId>
    </dependency>

      

+3


source to share


1 answer


Spring Boot defines all of its dependencies and versions of dependencies in the spring-boot-dependencies project . This project contains a pom with only dependencies and versions as properties.

Spring Data releases all compatible releases in a so-called release, and this ensures that all dependencies of that release work together.

When you take a closer look at the pom , you will see a maven property named spring-data-releasetrain.version

and for the upcoming Spring Boot 1.2 it points to the latest release version Evans-RELEASE

. Version 1.1.7 refers to the previous version Dijkstra-SR4

. I would suggest upgrading from 1.1.6 to 1.1.7 just in case.



The project already has a project spring-boot-starter-parent

as a parent, so in theory updating Spring Data versions should be as easy as overriding the specified property.

<properties>
    <spring-data-releasetrain.version>Evans-RELEASE</spring-data-releasetrain.version>
</properties>

      

As previously mentioned, it is preferable to use the exhaust train as this will allow you to get all compatible versions.

+9


source







All Articles