应用程序属性:
springdoc.swagger-ui.path=/swagger-ui.html
pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.5.0</version>
</dependency>
@RestController 也放上控制器类。
我可以正常获取http://localhost:8080/v3/api-docs, 但 http://localhost:8080/swagger-ui.html 得到 404 与 http://localhost:8080/swagger-ui/index.html 的情况相同
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Sat Dec 07 23:12:25 CST 2024
There was an unexpected error (type=Not Found, status=404).
您能否提供您的应用程序的 Spring Boot 版本。 另外请参阅此文档。 https://springdoc.org/