Swagger UI is not rendering on the browser

Background

I was going to document my Dog REST API with these two dependencies for Swagger:

pom.xml
1
2
3
4
5
6
7
8
9
10
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0</version>
</dependency>

Problem

When I tried to load the Swagger UI by navigating to http://localhost:8080/swagger-ui.html, the following error was displayed on the browser:

What’s wrong

From Swagger 3.0, we don’t need to add those two dependencies into the build tool. springfox-boot-starter should be added instead.

Solution

Replace those two dependencies with springfox-boot-starter dependency:

pom.xml
1
2
3
4
5
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>





References

Swagger UI is not rendering on the browser