Added Springfox Swagger-UI and it's not working, what am I missing?

后端 未结 11 1494
甜味超标
甜味超标 2020-12-02 00:00

Following the instructions here:

http://www.baeldung.com/swagger-2-documentation-for-spring-rest-api

I added these dependencies to my project:



        
相关标签:
11条回答
  • 2020-12-02 00:40

    I also ran into this and the issue was that we had a controller without path mapping (thus mapping to "/"). That was blocking the requests to the swagger-ui resources.

    0 讨论(0)
  • 2020-12-02 00:47

    Adding @RequestMapping("/") in controller level(after @RestController\@Controller annotation) helps me to get rid of the Request method 'GET' not supported issue. Thanks to Dhermanns's suggestion

    0 讨论(0)
  • 2020-12-02 00:49

    I tried most of these answers and the final solution was creeping..

    The right URL is the following

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

    I'm using Springfox swagger-ui 3.x.x

    Refer for complete swagger setup: http://muralitechblog.com/swagger-rest-api-dcoumentation-for-spring-boot/

    0 讨论(0)
  • 2020-12-02 00:50

    I got swagger issue /swagger-ui.html request method 'get' not supported\request method 'get' not supported.\supported methods post

    I was able to fix the issue

    In my controller api @RequestMapping() doesn't have path info. provided path like below Fix - @RequestMapping(value = '/v1/createAnalytic')

    0 讨论(0)
  • 2020-12-02 00:51

    I ran into this issue because I had endpoints with request mappings that had path variables of this form: /{var}. Turns out that this is an issue for both GET and POST endpoints i.e. GET /{var} and POST /{var} block swagger-ui. Once I made the paths more specific, I got swagger-ui to work.

    Quote from https://github.com/springfox/springfox/issues/1672

    When spring finds a simple path with just one variable swagger cannot intercept the URLs.

    Found by investigating various ideas in comments.

    0 讨论(0)
提交回复
热议问题