Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 将第二条路径添加到excludePathPattern无效(springboot拦截器)_Java_Spring Boot - Fatal编程技术网

Java 将第二条路径添加到excludePathPattern无效(springboot拦截器)

Java 将第二条路径添加到excludePathPattern无效(springboot拦截器),java,spring-boot,Java,Spring Boot,如您所见,“/file/download/*”无效,但“/file/show/*”有效。请帮助我,谢谢。您可以通过以下方式将排除模式传递到您的拦截器注册: 这不起作用,“/file/download/*”仍然被拦截这真的很奇怪,为什么第一个模式是validHey@super,被拦截路由的完整路径是什么?完整路径?本地主机:8080/file/**?例如,localhost:8080/file/delete/{id} public void addInterceptors(InterceptorR

如您所见,“
/file/download/*
”无效,但“
/file/show/*
”有效。请帮助我,谢谢。

您可以通过以下方式将排除模式传递到您的拦截器注册:


这不起作用,“/file/download/*”仍然被拦截这真的很奇怪,为什么第一个模式是validHey@super,被拦截路由的完整路径是什么?完整路径?本地主机:8080/file/**?例如,localhost:8080/file/delete/{id}
public void addInterceptors(InterceptorRegistry registry) {
   registry.addInterceptor(sessionInterceptor)
     .addPathPatterns("/file/**")
     .excludePathPatterns("/file/show/*","file/download/*")
     .addPathPatterns("/*_admin");

}
registry.addInterceptor(sessionInterceptor).
            addPathPatterns("/file/**").excludePathPatterns(Arrays.asList("/file/show/*","file/download/*"))
            .addPathPatterns("/*_admin");