[Swagger] Springdoc setting

nche·2022년 6월 24일

Add springdoc settings and environment variable

Springdoc settings honey tip 🍯

The supported-submit-methods array contains 'get', 'post', 'patch', 'put', 'delete', 'options'.
But if you leave an empty array, you can't try-out API, only use swagger as a API document.
Disable try-out feature is not officially supported, so you can use it as a trick.😋

    supported-submit-methods: []

Environment variable

  • They can be binding ☺ so I use the version property is environment ~ global🌏 ~ variable.
 version: v1
private static String VERSION;

private void setVERSION(String version){
    VERSION = version;

Create OpenAPI configuration bean 🫘

I found it a bit disappointing.
I tried to set up multiple external documents information.
Because method call chain is continuously possible.
But it only supported only one url and description set last.
Of course.
It's like a builder chain doing setter things.
I just kept overwriting the values. 😂

public ExternalDocumentation springdocDoc(){
  return new ExternalDocumentation()
public class ExternalDocumentation {
  private String description = null;
  private String url = null;

  public ExternalDocumentation url(String url) {
      this.url = url;
      return this;
  public ExternalDocumentation description(String description) {
      this.description = description;
      return this;
/* ellipsis */

0개의 댓글