Why does swagger springboot configure WebMvcConfiguer?

configure swagger Why many blogs can access web pages directly by configuring swagger configuration, and why do I need to configure this to access
springboot version using the latest version 2.0.6 and 2.9.2

@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {
    @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/");
    }
}
Sep.02,2021

has been resolved because the project referenced when configuring application.yml is configured

mvc:
    static-path-pattern: /static/**

causes several resources that are scanned by default to be overwritten and replaced. Just delete the configuration of this mvc

  • How to encrypt springboot swagger parameters

    for example, the swagger in the project can generate the api list normally, but the parameters of the api in our project are not transmitted in clear text, which leads to the failure of the simulation request of swagger. I would like to ask you how to co...

    May.22,2021
Menu