You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Boot Reactive自定义OpenAPI YAML文件无法加载问题求助

问题描述

为学习Spring Boot Reactive与函数式编程,我搭建了一个示例应用,引入OpenApi库并自定义了reactive_poc_v1.yml文件用于API定义。但访问Swagger地址时,提示该自定义YAML文件未找到。

相关配置细节

application.properties 配置

spring.application.name=reactive-poc
spring.main.web-application-type=reactive
springdoc.swagger-ui.url=/reactive_poc_v1.yml
springdoc.swagger-ui.path=/swagger-ui.html
springdoc.api-docs.path=/v3/api-docs
springdoc.api-docs.groups.enabled=true
springdoc.swagger-ui.enabled=true

pom.xml 依赖

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.1.5</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
...
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
    <version>2.3.0</version>
</dependency>
<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
    <version>2.3.0</version>
</dependency>
错误情况
  • 错误截图1:页面显示"Failed to load spec.",提示无法获取指定的/reactive_poc_v1.yml文件
  • 错误截图2:返回404 Not Found状态码,请求路径为/reactive_poc_v1.yml

注:reactive_poc_v1.yml文件路径为src\main\resources\static。

内容的提问来源于stack exchange,提问作者Praveen Dhasarathan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 07:27:32