当前位置:网站首页>解决swagger文档接口404的问题
解决swagger文档接口404的问题
2022-06-11 11:41:00 【无名之辈之码谷娃】
问题描述:swagger文件测试接口404排查和解决,遇到这样的问题如何解决和排查我们来看。

接口测试:

这个时候怎么解决呢?看日志
1,分析问题的根源,如果是加了权限控制要放行swagger 地址,显示我们这个不是swagger没有放行,那就是鉴权出了问题。

日志鉴权貌似也没有问题?那是什么原因导致的呢?

GET http://localhost:11031/{GET%20/ydpw/collection/list}
这个地址其实很多会说是多了一个空格其实不是的,正常会转码。
那么到底是什么问题?
原因是我们的服务名称和路由的名字都是一样这样不规范,导致地址找不到我们去掉控制器的名称就好了。

代码不规范,不摆烂了,所以代码要规范。。。
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 ([email protected])
*/
package cn.citms.portal.cms.controller;
import cn.citms.example.entity.cms.TblDirectoryCollection;
import cn.citms.example.vo.cms.DirectoryCollectionVo;
import cn.citms.portal.cms.service.DirectoryService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.UUID;
/**
* 答案选项 控制器
*
* @author Blade
* @since 2022-02-16
*/
@RestController
@AllArgsConstructor
@RequestMapping("/collection")
@Api(value = "目录收藏", tags = "目录收藏")
public class DirectoryCollectionController extends BladeController {
private DirectoryService directoryService;
/**
* 详情
*/
@GetMapping("/list")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "当前用户所有收藏", notes = "当前用户所有收藏")
public R detail(DirectoryCollectionVo directoryCollection) {
List<DirectoryCollectionVo> result = directoryService.list(directoryCollection);
return R.data(result);
}
}
边栏推荐
- Collection of practical WordPress plug-ins (under update)
- Test cos HTML cache static cache plug-in
- msf cs openssl流量加密
- Enterprise wechat applet pit avoidance guide, welcome to add...
- Use of Chinese input method input event composition
- web开发选型,web开发毕业谁
- JS interview questions - arrow function, find and filter some and every
- Mongodb usage
- Bark – 自己给自己的 iPhone 发推送提醒 – 最简单的推送提醒服务,开源免费
- Let WordPress support registered users to upload custom avatars
猜你喜欢

It will be too late if you don't brush the questions. The most complete bat interview questions

The application of the spingboot+quartrz production environment supports distributed, custom corn, reflective execution of multiple tasks

Cap theory sounds very big, but it's actually very simple

MYCAT sub database and sub table

Elk - elastalert largest pit

Uncaught typeerror: cannot set property 'next' of undefined

The complete manual of the strongest Flink operator is a good choice for the interview~

How to solve the problem that high-precision positioning technologies such as ultra wideband UWB, Bluetooth AOA and RTK cannot be widely used due to their high cost? Adopt the idea of integrated deplo

ELK - Hearthbeat实现服务监控

CVPR 2022 | 文本引导的实体级别图像操作ManiTrans
随机推荐
P2580 "so he started the wrong roll call"
arguments.callee 实现函数递归调用
JS 加法乘法错误解决 number-precision
2019年书单
web开发选型,web开发毕业谁
Node连接MySql数据库写模糊查询接口
NFT digital collection system development and construction process
National multi-year solar radiation spatial distribution data 1981-2022, temperature distribution data, evapotranspiration data, evaporation data, rainfall distribution data, sunshine data, wind speed
C# 将OFD转为PDF
WordPress登录页面美化插件:Login Designer推荐
【碎碎念】关于波长|波速|周期的想法
JS interview questions - arrow function, find and filter some and every
WordPress landing page customization plug-in recommendation
Intermediate web development engineer, interview questions + Notes + project practice
Guangdong municipal safety construction data management software 2022 new forms are coming
WordPress用户名修改插件:Username Changer
What is the latest popular annuity insurance product with higher income in 202?
Zhejiang University and Microsoft Asia Research Institute released a new method of video recognition, which can recognize video frame by frame without data marking, or can be used for sign language tr
Uncaught typeerror: cannot set property 'next' of undefined
Cap theory sounds very big, but it's actually very simple