java - 从 springfox2 迁移到 springfox 3.0
问题描述
我的 springboot 应用程序使用了 springfox2。我尝试迁移到 springfox3(“io.springfox:springfox-boot-starter:3.0.0”)。我按照https://springfox.github.io/springfox/docs/current/#example-application第 2.1.3 节中的步骤进行操作。从现有的 2.x 版本迁移。此外,我替换了一些不推荐使用的类(例如 globalRequestParameters、globalResponses、schma 等),但生成的文档存在一些问题。有人有文档或示例吗?非常感谢!!
问题:服务器 url 显示 localhost
招摇 yaml 文件显示
openapi: 3.0.3
info:
title: api title
description: api description
version: '1'
servers:
- url: 'http://localhost:8081'
description: Inferred Url
我希望服务器 url 成为我的 api 服务器 url 而不是 localhost。我试过了:
return new Docket(DocumentationType.OAS_30)
.groupName("host url") //if comment out this, it will retrun localhost
.host("host url")
...
设置了 groupName,这将返回 404 错误
解决方案
推荐阅读
- kubernetes - 如何修改源代码和部署 Kubernetes
- html - 有人可以检查我的 html 音频代码有什么问题吗?
- javascript - Promise.all([...]) 填充对象
- regex - 正则表达式 RE2 匹配所有电子邮件,但一个特定的,我不能使用“?!”
- visual-studio - 我应该将 Visual Studio 调试器附加到哪个进程来调试 Kestrel 应用程序?
- javascript - 显示 API 结果
- flutter - 应用启动,只有白屏,奇怪的流错误信息
- jquery - “System.Web.HttpServerUtility”不包含“JavaScriptStringEncode”的定义
- javascript - 您可以使用 jQuery 处理程序作为 .on() 的选择器吗?
- c# - WPF标签背景png图片透明