不推荐使用AntPathRequestMatcher。什么是替换方法?

时间:2019-01-10 09:49:55

标签: java spring-security

我正在尝试为登录页面创建注销选项。

  AntPathRequestMatcher pathRequestMatcher = new AntPathRequestMatcher("/logout");
  http.logout().logoutRequestMatcher(pathRequestMatcher); 

由于org.springframework.security.web.util.AntPathRequestMatcher.AntPathRequestMatcher在Spring Security 4.1.6中是deprecated,我应该使用哪个类?

1 个答案:

答案 0 :(得分:3)

AntPathRequestMatcher在Spring 3.x和Spring 4.x之间移动了软件包

引自Migrating from Spring Security 3.x to 4.x

  

RequestMatcher及其实现已从软件包中移出   org.springframework.security.web.util至   org.springframework.security.web.util.matcher

     

特别是

     

org.springframework.security.web.util.AntPathRequestMatcher→   org.springframework.security.web.util.matcher.AntPathRequestMatcher