SpringBootにSwagger(OpenAPI)を導入

Rest APIの一覧を把握したくて、Swaggerを導入した。

設定は簡単だった。

build.gradle.ktsに以下を追加しただけ

dependensies {
...
    implementation("org.springdoc:springdoc-openapi-ui:1.5.5")
...
}

これでSpringBootを起動して http://localhost:8080/swagger-ui.html にアクセスすると画面が表示された

あと、本番環境では動かしたくないので、本番環境用のapplication.propertiesに以下を記載

springdoc.swagger-ui.enabled=false