当前位置:网站首页>解决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);
}
}
边栏推荐
- NFT digital collection system development and construction process
- WordPress user name modification plug-in: username changer
- Guice integrated properties configuration
- Use compiler option '--downleveliteration' to allow iteration of iterations
- 导师转我800块,让我仿真一个电路(电源设计)
- Recommend several gravatar avatar caching plug-ins
- Learn 02 - slice, morphological change and dimension exchange of numpy multidimensional array
- Only when you find your own advantages can you work tirelessly and get twice the result with half the effort!
- How to form a good habit? By perseverance? By determination? None of them!
- 推荐几款Gravatar头像缓存插件
猜你喜欢

Intl.NumberFormat 设置数字格式

2022 | framework for Android interview -- Analysis of the core principles of binder, handler, WMS and AMS!

Interview experience of Xiaomi Android development post~

Qt中radioButton使用

Liufan, CFO of papaya mobile, unleashes women's innovative power in the digital age

中文输入法输入事件composition的使用
![my. Binlog startup failure caused by the difference between [mysql] and [mysqld] in CNF](/img/bd/a28e74654c7821b3a9cd9260d2e399.png)
my. Binlog startup failure caused by the difference between [mysql] and [mysqld] in CNF

js面试题---箭头函数,find和filter some和every

Uncaught TypeError: Cannot set property ‘next‘ of undefined 报错解决

CVPR 2022 | 文本引导的实体级别图像操作ManiTrans
随机推荐
Is it safe for Xiaobai to open an account directly on the flush?
Guangdong municipal safety construction data management software 2022 new forms are coming
Typescript compilation options and configuration files
Fast build elk7.3
AGCO AI frontier promotion (6.11)
实用WordPress插件收集(更新中)
mongoDB 使用
C# 读取txt文件生成Word文档
01_ Description object_ Class diagram
Only when you find your own advantages can you work tirelessly and get twice the result with half the effort!
在毕设中学习02——numpy多维数组的切片,形态变化,维度交换
在毕设中学习03
Recommend several gravatar avatar caching plug-ins
C# 在PDF文档中应用多种不同字体
C# 将OFD转为PDF
Elk - elastalert largest pit
导师转我800块,让我仿真一个电路(电源设计)
js合并两个对象(面试题)
Use compiler option '--downleveliteration' to allow iteration of iterations
my.cnf中 [mysql]与[mysqld] 的区别 引起的binlog启动失败的问题