我最近才開(kāi)始使用彈簧啟動(dòng)器Webflux來(lái)嘗試反應(yīng)式Web堆棧,并且在項(xiàng)目中遇到了一個(gè)非常簡(jiǎn)單的 Rest控制器的問(wèn)題。以下是拼圖的必要部分:砰.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;現(xiàn)在,當(dāng)我通過(guò)Eclipse將應(yīng)用程序作為彈簧啟動(dòng)應(yīng)用程序運(yùn)行并執(zhí)行卷曲或Postman請(qǐng)求時(shí),我得到一個(gè)404 :查看控制臺(tái)日志,我沒(méi)有看到為定義的請(qǐng)求映射綁定任何請(qǐng)求映射。任何關(guān)于為什么會(huì)發(fā)生這種情況的想法,因?yàn)楦鶕?jù)文檔,我理解即使使用Webflux也可以使用@RestController注釋
彈簧啟動(dòng)網(wǎng)絡(luò)流量無(wú)法解析 Rest控制器
寶慕林4294392
2022-09-28 14:32:09