突然发现项目的swagger报No operations defined in spec!

SWAGGER_SCAN_BASE_PACKAGE 路径改变了!

package com.redis.configuration;

import java.sql.Date;
import java.time.LocalDate; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2; @Configuration
@EnableSwagger2
public class SwaggerConfig { public static final String SWAGGER_SCAN_BASE_PACKAGE = "com.redis";
public static final String VERSION = "1.0.0"; @Value("${swagger.enable}")
private boolean enableSwagger; ApiInfo apiInfo() {
return new ApiInfoBuilder().title("Swagger API").description("This is to show api description")
.license("Apache 2.0").licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
.termsOfServiceUrl("").version(VERSION).contact(new Contact("", "", "miaorf@outlook.com")).build();
} @Bean
public Docket customImplementation() {
return new Docket(DocumentationType.SWAGGER_2).select()
.apis(RequestHandlerSelectors.basePackage(SWAGGER_SCAN_BASE_PACKAGE)).build()
.enable(enableSwagger)
.directModelSubstitute(LocalDate.class, java.sql.Date.class)
.directModelSubstitute(Date.class, java.util.Date.class).apiInfo(apiInfo());
}
}

swagger报No operations defined in spec!的更多相关文章

  1. 由ASP.NET Core WebApi添加Swagger报错引发的探究

    缘起 在使用ASP.NET Core进行WebApi项目开发的时候,相信很多人都会使用Swagger作为接口文档呈现工具.相信大家也用过或者了解过Swagger,这里咱们就不过多的介绍了.本篇文章记录 ...

  2. Swagger 报错 no mapping found for http request with uri [/***/swagger-ui.html] in dispatcherservlet with name '***'

    swagger报错: no mapping found for http request with uri [/***/swagger-ui.html] in dispatcherservlet wi ...

  3. selenium+python自动化96-执行jquery报:$ is not defined

    前言 背景介绍:做wap页面自动化的时候,把url地址直接输入到浏览器(chrome浏览器有手机wap模式)上测试,有个按钮死活点不到,用wap模式的触摸事件也无法解决,后来想用jquery去执行点击 ...

  4. Mvc Swagger报错的解决办法。

    报错信息:Not supported by Swagger 2.0: Multiple operations with path ‘xxxx.aspx’ and method 'POST' 解决办法出 ...

  5. swagger报错No handler found for GET /swagger-ui.html

    今天下载jeeweb框架下来研究,其他还有,就是swagger老是出不来.报错:No handler found for GET /swagger-ui.html 后来搜索才发现,这个错误,是因为资源 ...

  6. swagger 报错:illegal defaultValue null for param type integer

    swagger(版本2.9.2) 刷新报错,错误信息如下图: 问题原因: 根据上面这句报错信息,点进去AbstractSerializableParameter.java:412可以看到 源码, @J ...

  7. SpringBoot项目集成swagger报NumberFormatException: For input string: ""

    java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.f ...

  8. Spring Boot整合Swagger报错:"this.condition" is null

    前段时间看到群里有吐槽swagger整合问题,当时没仔细看,总以为是姿势不对. 这两天正好自己升级Spring Boot版本,然后突然出现了这样的一个错误: Caused by: java.lang. ...

  9. Vue运行报错--not defined

    按F12键进入调试模式,谷歌总是提示Uncaught ReferenceError: ——is not defined这个错误. 原来是因为虽然是传递的值,但是在函数传参的时候也要加引号,加上引号后就 ...

随机推荐

  1. Horizon的本地化

    1. 准备工作 apt-get install gettext horizon源码下载路径 /workspace/horizon/   2. 生成mo文件 django-admin.py makeme ...

  2. 全球常用NTP服务器地址及IP列表ntpdate

    pool.ntp.org是一组授时服务器虚拟集群,在全球有3000多台服务器,只需要这样写就行了,具体哪台服务器提供服务无需关心. time.windows.com   微软 asia.pool.nt ...

  3. BZOJ2303: [Apio2011]方格染色 【并查集】

    Description Sam和他的妹妹Sara有一个包含n × m个方格的表格.她们想要将其的每个方格都染成红色或蓝色.出于个人喜好,他们想要表格中每个2 × 2的方形区域都包含奇数个(1 个或 3 ...

  4. HDU2896 病毒侵袭 【AC自动机】

    HDU2896 病毒侵袭 Problem Description 当太阳的光辉逐渐被月亮遮蔽,世界失去了光明,大地迎来最黑暗的时刻....在这样的时刻,人们却异常兴奋--我们能在有生之年看到500年一 ...

  5. UWP 中的 LaunchUriAsync,使用默认浏览器或其他应用打开链接

    古老的 Win32 应用启动其他程序太过方便,以至于一部分开发者都已经不记得 Windows 能通过关联协议的方式通过统一资源定位符(URI)来启动应用程序了. 转到 UWP 后,使用 URI 启动应 ...

  6. js 时间date格式化

    js中没有类似java中的DateFormat类来处理日期格式化,可以自己写一个: var newDate=new Date(); var year=newDate.getFullYear(); va ...

  7. 《DSP using MATLAB》示例Example7.10

    代码: ws1 = 0.2*pi; wp1 = 0.35*pi; wp2 = 0.65*pi; ws2 = 0.8*pi; As = 60; tr_width = min((wp1-ws1), (ws ...

  8. vs2013 boost signals

    #include "stdafx.h" #include <boost/signals2/signal.hpp> #include <iostream> u ...

  9. 使用dnSpy对目标程序(EXE或DLL)进行反编译修改并编译运行

    本文为原创文章.源代码为原创代码,如转载/复制,请在网页/代码处明显位置标明原文名称.作者及网址,谢谢! 本文使用的工具下载地址为: https://github.com/cnxy/dnSpy/arc ...

  10. [LeetCode系列]BST有效性确定问题[前序遍历]

    给定一个BST的根节点, 试判断此BST是否为符合规则的BST? 规则: 对于一个BST的节点, 它左侧的所有节点(包括子节点)必须小于它本身; 它右侧的所有节点(包括子节点)必须大于它本身; 它的左 ...