swagger-ui endpoint doesn't seem to work
See original GitHub issueI’m trying to figure out how to get at the Swagger UI using the Springfox artifacts in a Spring Boot MVC application. Unfortunately the reference documentation is rather misleading, since the neither documented endpoint or the (different) endpoint in the screenshot exist in my application.
I’m using the following dependencies in Maven:
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.0.1</version>
</dependency>
My Docket Bean is very simple for now:
@Bean
public Docket myAPI() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.paths(paths())
.build();
}
Looking at /mappings
in Spring Boot, I have /swagger-resources
and /v2/api-docs
, but can’t find an endpoint for the UI.
Am I doing something wrong, experiencing a bug, or suffering from bad documentation?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:14
- Comments:57 (18 by maintainers)
Top Results From Across the Web
Added Springfox Swagger-UI and it's not working, what am I ...
I ran into this issue because I had endpoints with request mappings that had path variables of this form: /{ ...
Read more >Troubleshooting issues when using Swagger as a REST API ...
Ensure that the following conditions are met: The HTTP server is up and running. The HTTP server can host the HTML file. The...
Read more >How to Use Swagger Inspector
Signing up (or logging in, if you have an account) allows you to save your call history, pin requests, use collections, and create...
Read more >Get started with Swashbuckle and ASP.NET Core
Learn how to add Swashbuckle to your ASP.NET Core web API project to integrate the Swagger UI.
Read more >Show only specific APIs on Swagger — Asp.Net Core - Medium
In this article, I explain how to use Document Filters on Swagger in order to control the endpoints that are being shown on...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have added following in the class where i put @EnableWebMvc annotation. It works fine for me.
I have removed the extra swagger 1.5.0 dependency and ensured that I am using the wordnik package names for the API annotations. This appears to make no difference to the resulting behaviour.
My application is defined with the following annotations:
I did have an
@Configuration
class with@EnableWebMvc
on it. Removing the@EnableWebMvc
annotation seems to fix the missing/swagger-ui.html
endpoint. The documentation implies the opposite is true, stating that adding the annotation may fix a NullPointerException.I had to disable security configurations for various swagger-ui related endpoints to get the UI to load properly, but I got there in the end. Thanks for your help.