首页 > 其他分享 >swagger2 报404

swagger2 报404

时间:2022-09-29 18:12:28浏览次数:74  
标签:addResourceHandler classpath swagger2 404 registry addResourceLocations

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

加上以上配制就可以了。

 

之前的https://www.cnblogs.com/jiduoduo/p/15638916.html

标签:addResourceHandler,classpath,swagger2,404,registry,addResourceLocations
From: https://www.cnblogs.com/jiduoduo/p/16742509.html

相关文章