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

前端 未结 13 922
醉话见心
醉话见心 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:42

    For Spring 2 use @SpringBootApplication annotation and extends your class application from SpringBootServletInitializer then override the method SpringApplicationBuilder

    @SpringBootApplication
    public class TestApp extends SpringBootServletInitializer{
    
        @Override
        protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
            return application.sources(TestApp.class);
        }
    
    
        public static void main(String[] args) {
            SpringApplication.run(TestApp.class, args);
        }
    }
    

提交回复
热议问题