1. 程式人生 > >spring boot設定多個靜態資源目錄

spring boot設定多個靜態資源目錄

@Configuration
public class AcbplatformConfigurer
extends WebMvcConfigurerAdapter 
{

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**").addResourceLocations("classpath:static/");
//        無效registry.addResourceHandler("/3.0/**").addResourceLocations("/WEB-INF/classes/static2.0/");
//        無效registry.addResourceHandler("/4.0/**").addResourceLocations("static2.0/");
        super.addResourceHandlers(registry);
    }
}