Spring Data MongoDB Reactive 简介以及如何将其移至云端

在这篇文章中,我们将了解如何通过 Spring Data Reactive Repositories 和 MongoDB 使用 Reactive Programming 配置和实现数据库操作以在本地运行,然后了解如何通过 Platform.sh 将其顺利迁移到云端。

反应式编程是一种编程范式,它提倡异步、非阻塞、事件驱动的数据处理方法。反应式编程涉及将数据和事件建模为可观察的数据流,并实施数据处理例程以对这些流中的变化做出反应。

为了说明 Reactive MongoDB,我们将创建一个应用程序来处理和存储希腊神话中的商品。为了使用 Reactive MongoDB,我们需要将依赖项添加到我们的 pom.xml。

<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4
   <modelVersion>4.0.0</modelVersion>
5
6
   <groupId>sh.platform.example</groupId>
7
   <artifactId>template-spring-mongodb-reactive</artifactId>
8
   <version>0.0.1</version>
9
10
   <properties>
11
    <platform.sh.version>2.2.3</platform.sh.version>
12
    <java.version>1.8</java.version>
13
</properties>
14
15
<parent>
16
    <groupId>org.springframework.boot</groupId>
17
    <artifactId>spring-boot-starter-parent</artifactId>
18
    <version>2.2.6.RELEASE</version>
19
</parent>
20
21
<dependencies>
22
    <dependency>
23
        <groupId>org.springframework.boot</groupId>
24
        <artifactId>spring-boot-starter-webflux</artifactId>
25
    </dependency>
26
    <dependency>
27
        <groupId>org.springframework.boot</groupId>
28
        <artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
29
    </dependency>
30
    <dependency>
31
        <groupId>org.springframework.boot</groupId>
32
        <artifactId>spring-boot-starter-test</artifactId>
33
        <scope>test</scope>
34
    </dependency>
35
</dependencies>
36
37
<build>
38
    <f
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值