我正在使用 Java 11 开发 Spring 项目 5.3 版本(不是 spring boot),我尝试包含 springdoc-openapi-ui 依赖项并创建了一个 OpenApiConfig 类,并且该项目也使用 spring security,因此我扩展了 WebSecurityConfigurerAdapter 以允许 swagger URL。
下面是我的pom依赖:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.8.0</version>
</dependency>
但是当我在这些更改后尝试点击 URL 时,页面上显示“未找到”。
我已经尝试过这些网址:
http://localhost:8080/swagger-ui.html http://localhost:8080/api/swagger-ui.html
任何帮助我解决这个问题的指示将不胜感激。
我想看到点击 URL 后打开的 swagger 页面,但我收到“未找到”错误
尝试使用此依赖项而不是您的依赖项
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.0</version>
</dependency>