如何使用Spring数据mongodb 2.1.0.RELEASE与spring boot 2.0.5和Jhipster 5.3.3?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (213)

我使用Spring-boot 2.0.5.RELEASE和Jhipster 5.3.3,我的pom如下:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.github.jhipster</groupId>
            <artifactId>jhipster-dependencies</artifactId>
            <version>${jhipster-dependencies.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <!-- jhipster-needle-maven-add-dependency-management -->
    </dependencies>
</dependencyManagement>
...
<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
...

现在我了解到Spring数据已经为MongoDB4事务管理发布了支持,我想尝试一下,因为它听起来很酷!

基于spring参考文档:https//docs.spring.io/spring-data/mongodb/docs/2.1.0.RELEASE/reference/html/#dependencies

使用弹簧数据mongodb 2.1.0.RELEASE与弹簧启动一样简单,只需添加releasetrain的BOM。我做了什么,我的pom成了:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.github.jhipster</groupId>
            <artifactId>jhipster-dependencies</artifactId>
            <version>${jhipster-dependencies.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <!-- jhipster-needle-maven-add-dependency-management -->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-releasetrain</artifactId>
            <version>Lovelace-RELEASE</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>

</dependencyManagement> 

但这并没有带来任何春季数据mongodb 2.1.0罐子,只有发布列车的爱情花坛。Maven只下载了releasetrain的pom并继续下载spring boot 2.0.5附带的spring数据mongodb 2.0.10。

提问于
用户回答回答于
用户回答回答于

在你的pom.xml中添加spring-data-mongodb

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-mongodb</artifactId>
    </dependency>

扫码关注云+社区

领取腾讯云代金券