栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

springboot2 集成 swagger3.0 使用了拦截器 出现报错 end of the stream or a document separator is expected

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

springboot2 集成 swagger3.0 使用了拦截器 出现报错 end of the stream or a document separator is expected

swagger版本:3.0.0

依赖:


	io.springfox
    springfox-boot-starter
    3.0.0

报错界面:

我看了网上很多人的,但是没有一个能解决我的情况

最后解决的配置是这样的:

package top.sehnsucht.common.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.*;



@Configuration
public class WebConfig implements WebMvcConfigurer {


    @Autowired
    @Qualifier(value = "loginInterceptor")
    private HandlerInterceptor handlerInterceptor;

    
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration registration = registry.addInterceptor(handlerInterceptor);
        //拦截路径
        registration.addPathPatterns("**"
                ,"/webjars**和/v2/**

参考:
https://blog.csdn.net/xyh930929/article/details/109537258
https://blog.csdn.net/Ju3tinZz/article/details/115762426
https://blog.xujiuming.com/ming/14d110a5.html

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/325119.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号