1.修改LogoutFilter的重定向地址
LogoutFilter logout = new LogoutFilter();
logout.setRedirectUrl(Constants.PREFIX +"/login");
2.修改ShiroFilterFactoryBean的filters
Map<String, Filter> filters=new HashMap<>();
filters.put(“logout”,logout);
3.修改ShiroFilterFactoryBean的filterChainDefinitionMap
Map<String, String> filterMap = new LinkedHashMap<>();
filterMap.put(Constants.PREFIX +"/logout",“logout”);
注意:
如果想把LogoutFilter 单独拿出来作为一个bean的话,要把它放到ShiroFilterFactoryBean的上面,
下图是我写的代码