Unable to bring up swagger-ui from spring-boot application

前端 未结 5 925
广开言路
广开言路 2020-12-29 23:14

I have a spring boot application that i am running using embedded tomcat server. I am partially successful in getting springfox-swagger integrated with the app. If i do a

5条回答
  •  春和景丽
    2020-12-29 23:46

    If you want to keep @EnableWebMvc annotation any way, you have to add the following

      @Override
        public void addResourceHandlers(ResourceHandlerRegistry registry) {
    
                registry.addResourceHandler("swagger-ui.html")
                        .addResourceLocations("classpath:/META-INF/resources/");
    
                registry.addResourceHandler("/webjars/**")
                        .addResourceLocations("classpath:/META-INF/resources/webjars/");
    
        }
    

提交回复
热议问题