我无法在swagger中显示我的spring文档。这是我的配置:
springdoc:
# api-docs:
# enabled: true
# path: /v3/api-docs/swagger-config
swagger-ui:
# path: /swagger-ui.html
disable-swagger-default-url: true
# config-url: /v3/api-docs/swagger-config
# url: /v3/api-docs
我输入这个URL来访问接口:http://localhost:8080/swagger-ui.html
问题是,它没有显示从以下位置加载的api-docs:
"http://localhost:8080/v3/api-docs/swagger-config“
现状: 200。
但是如果我在url字段中输入这个,它就会工作..我的目标不是每次都这样.
我测试了一切可能..。我不明白为什么不起作用
编辑: swagger-config
{"configUrl":"/v3/api-docs/swagger-config","oauth2RedirectUrl":"http://localhost:8080/swagger-ui/oauth2-redirect.html","url":"/v3/api-docs","validatorUrl":""}{"configUrl":"/v3/api-docs/swagger-config","oauth2RedirectUrl":"http://localhost:8080/swagger-ui/oauth2-redirect.html","url":"/v3/api-docs","validatorUrl":""}
发布于 2022-04-20 15:27:41
我有一个类似的问题,并能够通过更新springdoc演示项目‘springdoc-openapi-springdoc 2-webmvc’中的配置来复制它。我定义了以下属性:
springdoc.api-docs.path=/test/v3/api-docs
sprindoc.swagger-ui.config-url=/test/v3/api-docs/swagger-config
springdoc.swagger-ui.path=/test/swagger-ui.html
通过这种配置,我能够重现OP报告的问题。对我来说,唯一的解决办法是添加一个额外的属性:
springdoc.swagger-ui.url=/test/v3/api-docs
希望这能有所帮助。
https://stackoverflow.com/questions/71868266
复制相似问题