簡體   English   中英

spring 啟動 - springfox-boot-starter 集成給出 404,沒有錯誤

[英]spring boot - springfox-boot-starter integration giving 404 with no error

Java 版本:19.0.1 Springboot:3.0.1

使用依賴:

<dependency>
  <groupId>io.springfox</groupId>
  <artifactId>springfox-boot-starter</artifactId>
  <version>3.0.0</version>
</dependency>

Swagger 配置 class

@Configuration
public class SwaggerConfiguration {

  @Bean
  public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
      .select()
      .apis(RequestHandlerSelectors.any())
      .paths(PathSelectors.any())
      .build();
  }

沒有錯誤,應用程序正常啟動,但是訪問時

http://localhost:8060/swagger-ui是 404。

如果我使用的是@EnableSwagger2 ,那么它會在啟動應用程序時顯示錯誤,表明禮儀不可用。

我遵循了 swagger-2-documentation-for-spring-rest-api ,似乎不需要@EnableSwagger2注釋。

springfox-boot-starter版本3.0.0似乎不支持 Spring Boot 3。考慮切換到支持它的SpringDoc v2

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM