突然发现项目的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. wampserver2.5的php.ini位置在wamp\bin\apache\apache2.4.9\bin

    wampserver2.5的php.ini位置在wamp\bin\apache\apache2.4.9\bin php.ini有多个地方,C:\wamp\bin\php\php5.5.12下面有php ...

  2. 搭建Hadoop2.6.0+Eclipse开发调试环境(以及log4j.properties的配置)

    上一篇在win7虚拟机下搭建了hadoop2.6.0伪分布式环境.为了开发调试方便,本文介绍在eclipse下搭建开发环境,连接和提交任务到hadoop集群. 1. 环境 Eclipse版本Luna ...

  3. Serf 了解

    Introduction to Serf Welcome to the intro guide to Serf! This guide will show you what Serf is, expl ...

  4. c++深拷贝/浅拷贝

    拷贝构造函数,是一种特殊的构造函数,它由编译器调用来完成一些基于同一类的其他对象的构建及初始化.其唯一的参数(对象的引用)是不可变的(const类型).此函数经常用在函数调用时用户定义类型的值传递及返 ...

  5. git 获取远程分支

    另一哥们将分支push到库中,我怎么获取到他的分支信息呢? 如果安装了git客户端,直接选择fetch一下,就可以获取到了. 如果用命令行,运行 git fetch,可以将远程分支信息获取到本地,再运 ...

  6. RK3288 指令查看LCD分辨率

    通过下面指令可以查看当前系统设置的分辨率. root@xxx:/ # cd sys/class/graphics/fb0 cd sys/class/graphics/fb0 root@xxx:/sys ...

  7. 记一次socket_create()函数耗时异常记录

    背景: 下午开发时突然整个页面耗时增加,空接口每次都需要2-3秒的耗时,一开始以为连开发环境数据库出现问题,最后断开数据库跑,发现还是很慢 最终逐步调试此页面耗时,定位到了socket_create( ...

  8. linux 定时任务 Crond Crontab

    定时任务http://www.cnblogs.com/chensiqiqi/p/6367890.html http://www.cnblogs.com/chensiqiqi/p/6389611.htm ...

  9. C程序花括号嵌套层次统计(新)

    [问题描述] 编写程序,统计给定的C源程序中花括号的最大嵌套层次,并输出花括号嵌套序列,该程序没有语法错误. 注意:1)源程序注释(/* … */)中的花括号应被忽略,不参与统计.2)源程序中的字符串 ...

  10. Java--mysql实现分页查询--分页显示

    当数据库中数据条数过多时,一个页面就不能显示,这是要设置分页查询,首先要使用的是数据库sql语句的limit条件实现分组查询sql语句大概形式为: select * from table limit ...