Thursday, July 23, 2015

Use Swagger in Spring Boot

To use Swagger in Spring Boot,

add the following dependencies to `build.gradle`:

    compile("io.springfox:springfox-swagger2:2.1.1")
    compile("io.springfox:springfox-swagger-ui:2.1.1")

and add `@EnableSwagger2` as follows:

@SpringBootApplication
@EnableSwagger2
public class Application {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}

}

Open the following URL in your browser:

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

Reference:
http://springfox.github.io/springfox/docs/current/

No comments:

Post a Comment