Home > AI > Backend > SpringBoot >

Swagger

Step 1: install Swagger

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>2.9.2</version>
</dependency>

Step 2: enable Swagger

Add @EnableSwagger2 after @SpringBootApplication

Then you see the url after restarting the server

http://localhost:8080/v2/api-docs

Step 3: install Swagger UI

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger-ui</artifactId>
    <version>2.9.2</version>
</dependency>

Then you can check this url for all API documentations.

http://localhost:8080/swagger-ui.html

Leave a Reply