Documents Spring Boot actuator endpoint with OpenApi

mbarre

Michèle

Posted on January 6, 2021

Documents Spring Boot actuator endpoint with OpenApi

In my previous post, I shown how to create a custom Spring Boot actuator endpoint. It could be useful to have pretty web interface to document these endpoints and allow other people to easily access your api in a pretty way. You know, I'm a girl, I like pretty things ;)

So, I chosen to use OpenApi which is usually easy to use, usually... In fact, by default, actuator endpoint are not shown with OpenApi, and it was hard to find how to do. That's why I decide to write this small post.

First of all, you'll need this dependencies :

    implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.5.0'
    implementation group: 'org.springdoc', name: 'springdoc-openapi-data-rest', version: '1.5.0'
Enter fullscreen mode Exit fullscreen mode

Then, you just need to add these properties...

springdoc:
  show-actuator: true
Enter fullscreen mode Exit fullscreen mode

... And you got your actuator endpoint documentation !

Alt Text

... And you can test your endpoints

Alt Text

💖 💪 🙅 🚩
mbarre
Michèle

Posted on January 6, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related