Why does springfox-swagger2 UI tell me “Unable to infer base url.”

前端 未结 13 925
醉话见心
醉话见心 2020-12-10 11:01

Why does springfox-swagger2 UI tell me Unable to infer base url. As far as I know, I am using a typical Swagger spring-boot configuration.

As you can

13条回答
  •  长情又很酷
    2020-12-10 11:44

    It turns out that the solution to my problem was to move the @EnableSwagger2 annotation into the main Configuration class, along with the Docket Bean.

    I had created a separate class in a sub-package with the Docket Bean and I was expecting it to get scanned by Spring and load the bean. Perhaps I failed to annotate that docket class with @Component, or maybe the the problem was something else, but I got it working.

提交回复
热议问题