DebuggableInterceptor实现HandlerInterceptor接口,在调用controller层接口后,进入preHandle()方法进入角色权限的校验
public abstract class DebuggableInterceptor implements HandlerInterceptor, EnvironmentAware {
@Autowired
protected PermissionProperties permissionProperties;
private Environment environment;
private final Set<String> debuggableEnvironments = Sets.newHashSet(new String[]{
"dev", "test", "sit", "qa"});
public DebuggableInterceptor() {
}
public void setEnvironment(Environment environment) {
this.environment = environment;
}
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
if (!(handler instanceof HandlerMethod)) {
return true;
} else {
return this.permissionProperties.isDebug() && PermissionUtil.containsAny(this.debuggableEnvironments, this.environment.getActiveProfiles()) ? true : this.doPreHandle(request, response, (HandlerMethod)handler);
}
}
public abstract boolean doPreHandle(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod);
}
public abstract class AbstractPermissionInterceptor extends DebuggableInterceptor {
public AbstractPermissionInterceptor() {
}
public boolean doPreHandle(