首页 > 解决方案 > AntPathRequestMatcher 已弃用。更换方法是什么?

问题描述

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

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

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

标签: javaspring-security

解决方案


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

正如从 Spring Security 3.x 迁移到 4.x所引用的:

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

具体来说

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


推荐阅读