admin管理员组文章数量:1406942
Having about 6 Spring Boot applications with REST APIs running with Actuator and Prometheus support.
These are running on Docker, but the actuator port is not exposed.
Although we can connect each application actuator to an Prometheus and Grafana instance.
On of the application has OpenAPI documentation with SwaggerUI. This SwaggerUI is exposed through Actuator management port.
<dependency>
<groupId>.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.8.5</version>
</dependency>
Now I want to make similar OpenAPI documentation for the other applications.
However having our users to deal with 6+ different URLs for accessing the various OpenAPI documentation is not a good solution.
Is there any way I can combine all the SwaggerUIs OpenAPI definitions into one single SwaggerUI something similar as I do with Actuator and Prometheus?
Otherwise I was thinking the only way is to have each application generate an openapi.json for its APIs, then "somehow" export this file to a running SwaggerUI application (running on docker).
I can generate an openapi.json for each application with the springdoc-openapi-maven-plugin
.
Having about 6 Spring Boot applications with REST APIs running with Actuator and Prometheus support.
These are running on Docker, but the actuator port is not exposed.
Although we can connect each application actuator to an Prometheus and Grafana instance.
On of the application has OpenAPI documentation with SwaggerUI. This SwaggerUI is exposed through Actuator management port.
<dependency>
<groupId>.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.8.5</version>
</dependency>
Now I want to make similar OpenAPI documentation for the other applications.
However having our users to deal with 6+ different URLs for accessing the various OpenAPI documentation is not a good solution.
Is there any way I can combine all the SwaggerUIs OpenAPI definitions into one single SwaggerUI something similar as I do with Actuator and Prometheus?
Otherwise I was thinking the only way is to have each application generate an openapi.json for its APIs, then "somehow" export this file to a running SwaggerUI application (running on docker).
I can generate an openapi.json for each application with the springdoc-openapi-maven-plugin
.
1 Answer
Reset to default 1What I have used previously is a wrapper/façade Swagger UI server.
It presents a dropdown to choose one of the 6 services. That fetches the v2/api-docs/management json (or v3/api-docs/management) for Actuator stuff from the nominated server and uses it as the base url in SwaggerUI. You need to make sure that the value of servers[].url
returned in api-docs json reflects the hostname of the actual server as seen by the browser. You can set this in Spring Boot with @OpenAPIDefinition(servers = {@Server(url = "https://hostname/",
The swagger page for a renamed server looks like the image below with the /v3/api-docs/management json.
本文标签: openapiSpring Boot Combine multiple applications SwaggerUIStack Overflow
版权声明:本文标题:openapi - Spring Boot: Combine multiple applications SwaggerUI? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744940942a2633479.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论