question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't find Swagger UI endpoint

See original GitHub issue

Please take the time to search the repository, if your question has already been asked or answered.

  • What version of the library are you using? 2.8.0 With spring boot.
    <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
    <dependency>
      <groupId>io.springfox</groupId>
      <artifactId>springfox-swagger2</artifactId>
      <version>2.8.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
    <dependency>
      <groupId>io.springfox</groupId>
      <artifactId>springfox-swagger-ui</artifactId>
      <version>2.8.0</version>
    </dependency>

What kind of issue is this?

  • Question. Is this a question about how to do a certain thing?

Hello,

I’m sure this is a stupid question but I’ve followed the steps on http://www.baeldung.com/swagger-2-documentation-for-spring-rest-api to get the swagger / swagger ui to work.

My docket config looks as follows:

  @Bean
  public Docket mainConfig() {
    return new Docket(DocumentationType.SWAGGER_2)
        .select().apis(RequestHandlerSelectors.any())
        .paths(PathSelectors.any())
        .build()
        .pathMapping("/swagger")
        .directModelSubstitute(LocalDate.class, String.class)
        .genericModelSubstitutes(ResponseEntity.class);
  }

With this I can go to /v2/api-docs to see the json version. However I can’t find the UI endpoint. When going to http://localhost:8080/swagger-resources/ I only see:

[
{
"name": "default",
"url": "/v2/api-docs",
"swaggerVersion": "2.0",
"location": "/v2/api-docs"
}
]

I’ve tried:

To no avail.

Thank you!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:69 (16 by maintainers)

github_iconTop GitHub Comments

19reactions
BahgatMashalycommented, Sep 28, 2018

I have encountered this problem before and the problem was in the below line in application.properties spring.resources.add-mappings=false

remove it or change it’s value to true

13reactions
ldahercommented, Jun 11, 2018

Hello @nWidart,

I was facing the same issue, but I’ve figured out what was happening in my case…

Although I see you have fixed the problem already, for those whom this suggestion hasn’t worked, if you’re using @EnableMvc in any java config file, remove it. I’ve not quite believed at the beginning, but it has worked.

Give it a try…

Regards,

Luciano Daher.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot get my endpoints list from controller in swagger UI
I'm just trying to configure my Rest controller endpoints to show on swagger UI screen but it shows No operations for specs defined....
Read more >
Installation - Swagger Documentation
The module's contents mirror the dist folder you see in the Git repository. The most useful file is swagger-ui-bundle.js , which is a...
Read more >
Setting Up Swagger 2 with a Spring REST API - Baeldung
Learn how to document a Spring REST API using Swagger 2. ... which provides a way to control the endpoints exposed by Swagger....
Read more >
Get started with Swashbuckle and ASP.NET Core
The generated document describing the endpoints appears as shown in OpenAPI specification (openapi.json). The Swagger UI can be found at https ...
Read more >
Configuring and Using Swagger UI in ASP.NET Core Web API
We are going to learn how to integrate the Swagger UI/OpenAPI in an ASP.NET Core Web API, ... we can test the endpoint...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found