我得到了最新的 Spring Boot 应用程序和 springdoc.swagger-ui。
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.2.32</version>
</dependency>
我的 application.properties 包含 springdoc.swagger-ui.path=/swagger-ui-openapi.html
当我通过 Intellij IDEA 运行应用程序时,http://localhost:8080/swagger-ui-openapi.html将我带到http://localhost:8080/swagger-ui/index.html?configUrl=/v3/api-docs/ swagger-config 和 Swagger UI 页面加载成功。
但是,如果我通过命令行启动应用程序:“java -jar my-app.jar”,当我尝试访问http://localhost:8080/时,我在浏览器中得到 404,并且在日志中出现错误 'Circular view path [error]' swagger-ui-openapi.html 并将我重定向到http://localhost:8080/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config
javax.servlet.ServletException: Circular view path [error]: would dispatch back to the current handler URL [/error] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
但是http://localhost:8080/v3/api-docs是可访问的,并且架构在此地址可用。
我怎样才能解决这个问题?