突然发现项目的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. 框架重构:测试中的DateTime.Now

    存在的问题 DateTime.Now是C#语言中获取计算机的当前时间的代码: 但是,在对使用了DateTime.Now的方法进行测试时,由于计算机时间的实时性,期望值一直在变化.如:计算年龄. pub ...

  2. 条件和循环(More Control Flow Tools)

    1.if语句 >>>a=7 >>> if a<0: ... print 'Negative changed to zero' ... elif a==0: . ...

  3. Mysql 分组查询最高分

    今天告诉我要写一个服务,目的是按照每个班中各分组中竞赛最高分组平分小组得分给各个成员的服务,于是就有两个技术需求 1 查询每个班的冠军团队 2 增加一组人的分数 从“1”中,查出每个班N个分组中的得分 ...

  4. Luogu P2742 模板-二维凸包

    Luogu P2742 模板-二维凸包 之前写的实在是太蠢了.于是重新写了一个. 用 \(Graham\) 算法求凸包. 注意两个向量 \(a\times b>0\) 的意义是 \(b\) 在 ...

  5. 如何最快速地将旧的 NuGet 包 (2.x, packages.config) 升级成新的 NuGet 包 (4.x, PackageReference)

    最近我将项目格式进行了升级,从旧的 csproj 升级成了新的 csproj:NuGet 包管理的方式也从 packages.config 升级成了 PackageReference.然而迁移完才发现 ...

  6. Adobe Acrobat 9 Pro破解方法

    首先安装Adobe Acrobat 9 Pro,默认安装在C盘. 如果你的系统盘是C盘,那么就删除:c:/Documents and Settings/All Users/Application Da ...

  7. Redis 字符串与哈希

    /*** * 字符串 redis里的字符串 ***/ //设置key的值 redis 127.0.0.1:6379> set key 'my name is imay' //设置值的过期时间 ( ...

  8. fatal: The remote end hung up unexpectedly解决办法

    $ git config --global http.postBuffer 2428000 git config http.postBuffer 524288000 配置完成后 git pull一下, ...

  9. JS实现动态提示框

    引言 什么项目都有个需求,应开发需求,需要写一个公式编辑器选择公式的插件,下面给大家讲一下实现过程.(擦汗,强作淡定,咳,开嗓~) 看图说话 本小菜开发功能前乐于先写个需求思维导图(纯属个人爱好): ...

  10. mac下导出JetBrains IDE Support插件给linux

    自从google被和谐以后,上google的store安装插件是如此的费劲,好在mac下的chrome已经装好了,直接导出给linux就可以 mac下chrome的插件目录为 ~/Library/Ap ...