解决SpringBoot整合Swagger报错No mapping for GET /aifruit/null/swagger-resources/configuration/security

发布于个人的CSDN上:解决SpringBoot整合Swagger报错No mapping for GET /aifruit/null/swagger-resources/configuration/security

问题

解决

/**
 * 解决swagger死循环问题
 * 视具体情况用,若控制台报错 No mapping for GET /aifruit/null/swagger-resources/configuration/security
 * 则使用下面代码
 * 下面这几个地址会一直轮询,改为重定向
 * /null/swagger-resources/configuration/ui
 * /null/swagger-resources/configuration/security
 * /null/swagger-resources
 */
@Override
public void addViewControllers(ViewControllerRegistry registry) {
    registry.addRedirectViewController("/null/api-docs",
            "/api-docs").setKeepQueryParams(true);
    registry.addRedirectViewController("/null/swagger-resources/configuration/ui",
            "/swagger-resources/configuration/ui");
    registry.addRedirectViewController("/null/swagger-resources/configuration/security",
            "/swagger-resources/configuration/security");
    registry.addRedirectViewController("/null/swagger-resources", "/swagger-resources");
}
posted @ 2021-03-03 14:41  MelodyJerry  阅读(3528)  评论(0编辑  收藏  举报
没有伞的孩子必须努力奔跑!|
载入天数...载入时分秒...
(っ•̀ω•́)っ✎⁾⁾ 开心每一天