swagger突然不好使,原来是被拦截器拦截

swagger突然不好使,原来是被拦截器拦截

解决:在WebMvcConfig文件中进行配置

 /**
     * 使用拦截器需要在这配置
     * 拦截 初始化的菜单(依据用户权限显示)
     *
     * @param registry todo
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        String[] excludePathArr = {"/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**"};
        registry.addInterceptor(authorizationInterceptor).addPathPatterns("/*/**").excludePathPatterns(excludePathArr);
    }
posted @ 2022-07-31 10:18  大于昨天  阅读(778)  评论(0编辑  收藏  举报