OpenAPI 3.0 Documentation for Spring

Last modified date

Comments: 0

The OpenAPI V3 specification is the successor to the original Swagger documentation.

This article will show you how to configure your Spring App to autogenerate the API documentation for the API you are developing.

Maven Dependency

The first step is to add the following dependency to your pom.xml


Setting API Definition Info

The @OpenAPIDefinition annotation allows for the specification of certain documentation details such as the name of the API services, version number, description etc.

@OpenAPIDefinition(info = @Info(title = "My API Service", version = "1.0", description = "The description of my service"))
public class Application {

    public static void main(String[] args) {, args);
OpenAPI v3 Swagger

Viewing The Documentation

Once you have imported the dependency, run your spring app and then visit:


Further Reading

If you liked this article, you will also find this Maven article useful as well.


Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.