spring boot WebMvcConfigurerAdapter WebMvcConfigurationSupport问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ypp91zr/article/details/84636979

使用了拦截器继承WebMvcConfigurerAdapter正常,静态资源会加载

在2.0以后WebMvcConfigurerAdapter被废弃了,使用WebMvcConfigurationSupport静态资源会无效。很多配置不会自动化

网上的方式是

@Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
	}

重写这个方法,但对我不实用,依然无效。做个问题记录,解决了补充

猜你喜欢

转载自blog.csdn.net/ypp91zr/article/details/84636979