Spring Boot 2.0.0.RELEASE中的ServerRequest

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Spring Boot 2.0.0.RELEASE中的ServerRequest相关的知识,希望对你有一定的参考价值。

我最近搬了我的应用程序。从Spring Boot 1到Spring Boot 2(2.0.0.RELEASE)。

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

我想导入类org.springframework.web.reactive.function.server.ServerRequest以从界面获取错误属性

org.springframework.boot.web.reactive.error.ErrorAttributes;

但是我收到了这个错误:

The import org.springframework.web.reactive.function.server.ServerRequest cannot be resolved
答案

Spring Boot Reactive Project spring-boot-web-reactive与Spring 5.0合并为Spring Webflux

确保你的类路径上有webflux Starter:

<dependency>
     <groupId>org.springframework</groupId>
     <artifactId>spring-webflux</artifactId>
</dependency>

以上是关于Spring Boot 2.0.0.RELEASE中的ServerRequest的主要内容,如果未能解决你的问题,请参考以下文章

spring boot版本对应

Spring boot 集成Spring Security

Spring Boot 发送邮件 javax.mail

Spring Boot依赖spring-boot-starter-parent是干啥的?

在 Spring Boot 2 指标中添加“平均值”、“最小值”或“百分位数”?

spring boot - 迫使我在运行时使用jersey client 1.19