要对e:\ myWeb \ resources文件夹下的所有文件启用静态文件访问,我已经使用ResourceHandlerRegistration org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry.addResourceHandler(String ... pathPatterns添加了资源处理程序)。
public class WebConfig extends WebMvcConfigurerAdapter implements ApplicationContextAware {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**").addResourceLocations("file:e:/myWeb/resources/");
}
}
但是我想限制对资源文件夹下特定文件夹的访问,例如e:/ myWeb / resources / WEB-INF文件夹。我该怎么做?