问题形容
如以下代码,将/user/register与/user/login列入排除项后,在进行拜访时,仍旧提醒重定向次数过多
<code class="java">/** * @author 1iin */ @Configuration public class MyWebMvcConfigurerAdapter implements WebMvcConfigurer { @Override public void addInterceptors(InterceptorRegistry registry) { UserInterceptor userInterceptor = new UserInterceptor(); InterceptorRegistration loginRegistry = registry.addInterceptor(userInterceptor); // 拦挡门路 loginRegistry.addPathPatterns("/**"); // 排除门路 loginRegistry.excludePathPatterns("/user/register"); loginRegistry.excludePathPatterns("/user/login"); } }
解决方案
经查明后发现当申请对应门路时办法不对应时,申请门路会主动转为/error
,就是因为这个起因导致了申请门路有限次的重定向