我最近才开始使用弹簧启动器Webflux来尝试反应式Web堆栈,并且在项目中遇到了一个非常简单的 Rest控制器的问题。以下是拼图的必要部分:砰.xml<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.4.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.hello.sample</groupId> <artifactId>sample-reactive-service</artifactId> <version>0.0.1-SNAPSHOT</version> <name>sample-reactive-service</name> <description>Demo project for Spring Boot</description> <properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-webflux</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>io.projectreactor</groupId> <artifactId>reactor-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build></project>样品控制器.javapackage com.hello.sample.controller;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.RestController;现在,当我通过Eclipse将应用程序作为弹簧启动应用程序运行并执行卷曲或Postman请求时,我得到一个404 :查看控制台日志,我没有看到为定义的请求映射绑定任何请求映射。任何关于为什么会发生这种情况的想法,因为根据文档,我理解即使使用Webflux也可以使用@RestController注释
1 回答
GCT1015
TA贡献1827条经验 获得超4个赞
context-path支持网络流量:https://github.com/spring-projects/spring-boot/issues/14082
添加回答
举报
0/150
提交
取消
