0% found this document useful (0 votes)
5 views

Swagger Docs Java

The document discusses how to add and configure the Swagger API documentation tool to a Spring Boot project. It describes adding Maven dependencies for Swagger, defining a SwaggerConfig class to configure Swagger, and verifying that Swagger is working by defining sample controllers and endpoints.

Uploaded by

arpithkumarba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Swagger Docs Java

The document discusses how to add and configure the Swagger API documentation tool to a Spring Boot project. It describes adding Maven dependencies for Swagger, defining a SwaggerConfig class to configure Swagger, and verifying that Swagger is working by defining sample controllers and endpoints.

Uploaded by

arpithkumarba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Page 1 of 2

Swagger2 For SpringBoot


Swagger is an open source project used to
generate the REST API documents for restful
Web services.It provides a user interface to
access our RESTful web services via the web
browser

Steps to add and con gure swagger2 for Springboot


project:-

1.Add Maven Dependencies


If you are using maven then add the following swagger
dependencies in your pom.xml

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>

2.De ne SwaggerCon g.java


Create SwaggerCon g class to add swagger in the spring boot project,
below is the sample swagger con guration for RiskMonitoring project
fi
fi
fi
fi
fi
Page 2 of 2

• @Configuration annotation is used to auto scan this


class le.
• @EnableSwagger2 annotation is used to help Spring boot
project to add necessary dependency for Swagger
3.Verify Swagger.
Now de ne some controllers to expose REST api endpoints and
start your spring boot application.
fi
fi

You might also like