突然发现项目的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. Win7 使用密码共享磁盘连接总是提示输入密码

    Win7 使用密码共享磁盘连接总是提示输入密码,只要设置下面这里就可以了.默认是保持来宾身份.

  2. sync-settings(vscode)

    vscode插件以及设置 sync-download e45c6db33cd91d661e0cc545efb6817c

  3. Yahoo关于性能优化的N条规则

    本来这是个老生常谈的问题,上周自成又分享了一些性能优化的建议,我这里再做一个全面的Tips整理,谨作为查阅型的文档,不妥之处,还请指正: 一. Yahoo的规则条例: 谨记:80%-90%的终端响应时 ...

  4. 《DSP using MATLAB》示例Example 7.13

    代码: M = 25; alpha = (M-1)/2; n = [0:1:M-1]; hd = (2/pi) * ( (sin( (pi/2)*(n-alpha) ).^2)./(n-alpha) ...

  5. Cucumber 使用例子

    1. junit 配置 @RunWith(Cucumber.class) @CucumberOptions(format ={"pretty","html:target/ ...

  6. mysql设置合适的索引长度

    理想的索引: 相对于写操作来说,表查询很频繁的表建立索引 字段区分度高 长度小(合适的长度,不是越小越好) 尽量能够覆盖常用字段 这些条件综合起来才能够达到最优索引,本次我们着重聊一下建立合适长度的索 ...

  7. 双口RAM,值得研究

    在FPGA设计过程中,使用好双口RAM,也是提高效率的一种方法. 官方将双口RAM分为简单双口RAM和真双口RAM. 简单双口RAM只有一个写端口,一个读端口. 真双口RAM分别有两个写端口和两个读端 ...

  8. GOF23设计模式之适配器模式(Adapter)

    一.适配器模式概述 将一个类的接口转换成客户可用的另外一个接口. 将原本不兼容不能在一起工作的类添加适配处理类,使其可以在一起工作. 二.适配器模式场景 要想只有USB接口的电脑想使用PS/2接口的键 ...

  9. Jmeter录制App 请求是HTTPS的

    1.jmeter开启代理后,在bin目录下找到 证书 2.把这个证书通过QQ发送到手机上面,使用QQ浏览器打开 安装证书,信任证书 3.jmeter里点击SSl管理器选择上面的证书(这部貌似为了抓浏览 ...

  10. if __name__=="__main__": 这个结尾的理解

    print "别人应用我做为模块导入,就只看到我" if __name__=="__main__": print "自己文件执行就看到我输出" ...