您好,我在使用 Maven 创建 Spring with Reactor 项目时遇到问题

Hi, I have a problem creating a Spring with Reactor project with Maven

我正在尝试做一个关于 Reactor 和 WebFlux 的教程,但是当我尝试在我的主 class 中导入 Mono 依赖项时。该包不存在。

import reactor.core.publisher.Mono;

包发布者在我的编辑器中被标记为红色。

pom.xml 处的依赖项是:

<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
        <version>2.4.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.projectreactor/reactor-core -->
    <dependency>
        <groupId>org.projectreactor</groupId>
        <artifactId>reactor-core</artifactId>
        <version>1.1.6.RELEASE</version>
    </dependency>


    <!-- https://mvnrepository.com/artifact/io.reactivex.rxjava2/rxjava -->
    <dependency>
        <groupId>io.reactivex.rxjava2</groupId>
        <artifactId>rxjava</artifactId>
        <version>2.2.20</version>
    </dependency>


    <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <version>2.4.0</version>
        <scope>test</scope>
    </dependency>

在此先感谢您的帮助。

我认为您指的是错误的工件,请使用下面的 Spring Webflux。

<dependency>
    <groupId>io.projectreactor</groupId>
    <artifactId>reactor-core</artifactId>
    <version>3.4.0</version>
</dependency>