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

SWAGGER_SCAN_BASE_PACKAGE 路径改变了!

  1. package com.redis.configuration;
  2. import java.sql.Date;
  3. import java.time.LocalDate;
  4. import org.springframework.beans.factory.annotation.Value;
  5. import org.springframework.context.annotation.Bean;
  6. import org.springframework.context.annotation.Configuration;
  7. import springfox.documentation.builders.ApiInfoBuilder;
  8. import springfox.documentation.builders.RequestHandlerSelectors;
  9. import springfox.documentation.service.ApiInfo;
  10. import springfox.documentation.service.Contact;
  11. import springfox.documentation.spi.DocumentationType;
  12. import springfox.documentation.spring.web.plugins.Docket;
  13. import springfox.documentation.swagger2.annotations.EnableSwagger2;
  14. @Configuration
  15. @EnableSwagger2
  16. public class SwaggerConfig {
  17. public static final String SWAGGER_SCAN_BASE_PACKAGE = "com.redis";
  18. public static final String VERSION = "1.0.0";
  19. @Value("${swagger.enable}")
  20. private boolean enableSwagger;
  21. ApiInfo apiInfo() {
  22. return new ApiInfoBuilder().title("Swagger API").description("This is to show api description")
  23. .license("Apache 2.0").licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
  24. .termsOfServiceUrl("").version(VERSION).contact(new Contact("", "", "miaorf@outlook.com")).build();
  25. }
  26. @Bean
  27. public Docket customImplementation() {
  28. return new Docket(DocumentationType.SWAGGER_2).select()
  29. .apis(RequestHandlerSelectors.basePackage(SWAGGER_SCAN_BASE_PACKAGE)).build()
  30. .enable(enableSwagger)
  31. .directModelSubstitute(LocalDate.class, java.sql.Date.class)
  32. .directModelSubstitute(Date.class, java.util.Date.class).apiInfo(apiInfo());
  33. }
  34. }

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. 在crontab中执行shell脚本的问题

    crontab中记录的编写比较简单,下面是一个示例: * * * /app/tpssapp/ftpsrc/tools/statTables/statTables.sh > /app/tpssap ...

  2. (function($){...})(jQuery)与$(function(){...})区别

    $(function(){...}) 这种写法和jQuery(function(){...}),$(document).ready(function(){...})作用一样,表示文档载入后需要运行的代 ...

  3. 如何通过eclipse查看、阅读hadoop2.4源码

    问题导读:1.官网src包下载包,能否直接使用?2.如何跟踪和查看hadoop源码? 此篇是从零教你如何获取hadoop2.4源码并使用eclipse关联hadoop2.4源码基础上的一个继续,上文其 ...

  4. 呵呵sql

    INSERT  INTO fnd_document_folder_structure_t (folder_name,parent_folder_id,company_type_id,inv_flag, ...

  5. iis 部署 未在本地计算机上注册“Microsoft.Jet.OleDb.4.0”提供程序

    C#读取Access数据库在VS调试时正常,发布到win7-64的IIS之后报错“未在本地计算机上注册“Microsoft.Jet.OleDb.4.0”提供程序”.原因是VS调试时模拟的是32位,发布 ...

  6. 洛谷 P1098 字符串的展开

    题目描述 在初赛普及组的“阅读程序写结果”的问题中,我们曾给出一个字符串展开的例子:如果在输入的字符串中,含有类似于“d-h”或者“4-8”的字串,我们就把它当作一种简写,输出时,用连续递增的字母或数 ...

  7. webpack 图片资源处理

    备注:  css 引用图片资源 1. 安装loader yarn add file-loader --dev 2. 配置 const path = require("path"); ...

  8. minio 介绍

      minio 兼容Amason的S3分布式对象存储项目,采用Golang实现,客户端支持Java,Python,Javacript, Golang语言. Minio可以做为云存储的解决方案用来保存海 ...

  9. 【转】VC 多线程中控制界面控件的几种方法

    原文网址:https://software.intel.com/zh-cn/blogs/2010/11/30/vc-3 为了保证界面的用户体验经常要把数据处理等放到子线程中进行,然后把结果更新到主界面 ...

  10. hadoop深入学习之SequenceFile

    的1个byte 3.Key和Value的类名 4.压缩相关的信息 5.其他用户定义的元数据 6.同步标记,sync marker Metadata 在文件创建时就写好了,所以也是不能更改的.条记录存储 ...