【发布时间】:2021-05-21 11:36:52
【问题描述】:
我有 springfox swagger2,其中 http://localhost:8080/context/swagger-ui.html 工作正常。
现在我已经修改了所有的更改,使其成为 open-api 可运行的。
使用:Migrating from springfox swagger2 to springdoc openapi
现在我可以使用如下组名打开我的服务定义 json:
http://localhost:8080/context-path/v3/api-docs/groupName
但无法像之前使用 springfox 2.0 那样打开 swagger-ui.html
您能帮我吗,如何打开以及网址应该是什么?
当我输入 http://localhost:8080/context/swagger-ui.html 时,它正在创建如下所示的新路由并且没有打开任何内容,404 错误。
http://localhost:8080/context/swagger-ui/index.html?configUrl=/context/v3/api-docs/swagger-config
请注意,我已经在我的项目中添加了 swagger-ui.html,因为它已经为 swagger 2.0 添加了
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
请帮忙弄个swagger主屏幕,这样我就可以测试休息服务了
【问题讨论】:
-
请帮助.......
标签: spring-mvc swagger-ui swagger-2.0 springdoc springdoc-openapi-ui