springboot集成swaggerUI

有这样的需求

1.在每个接口上都增加一个字段;

2.接口文档只展示满足一定条件URL的接口

配置文件

详细看代码

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;
import java.util.List;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.service.Parameter; @Configuration
@EnableSwagger2
public class SwaggerConfig {
ApiInfo apiInfo(){
return new ApiInfoBuilder().title("显示的标题").description("标题描述").build();
} @Bean
public Docket api(){
ParameterBuilder tokenPar = new ParameterBuilder();
List<Parameter> pars = new ArrayList<Parameter>(); tokenPar.name("Authorization").description("token").modelRef(new ModelRef("string")).defaultValue("").parameterType("header").required(false).build();
pars.add(tokenPar.build());
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.regex("/go(d|to)/.*"))
.build()
.globalOperationParameters(pars)
.apiInfo(apiInfo());
} }

spring boot 配置swagger UI的更多相关文章

  1. Spring boot 配置 swagger

    1.maven配置包 <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 --> <dep ...

  2. Spring boot集成Swagger,并配置多个扫描路径

    Spring boot集成Swagger,并配置多个扫描路径 1:认识Swagger Swagger 是一个规范和完整的框架,用于生成.描述.调用和可视化 RESTful 风格的 Web 服务.总体目 ...

  3. 【Swagger】可能是目前最好的 Spring Boot 集成 swagger 的方案

    [Swagger]可能是目前最好的Spring Boot集成 swagger 的方案 ![](https://img2018.cnblogs.com/blog/746311/201909/746311 ...

  4. Spring Boot 集成 Swagger 生成 RESTful API 文档

    原文链接: Spring Boot 集成 Swagger 生成 RESTful API 文档 简介 Swagger 官网是这么描述它的:The Best APIs are Built with Swa ...

  5. Spring Boot 集成 Swagger,生成接口文档就这么简单!

    之前的文章介绍了<推荐一款接口 API 设计神器!>,今天栈长给大家介绍下如何与优秀的 Spring Boot 框架进行集成,简直不能太简单. 你所需具备的基础 告诉你,Spring Bo ...

  6. spring boot集成swagger,自定义注解,拦截器,xss过滤,异步调用,guava限流,定时任务案例, 发邮件

    本文介绍spring boot集成swagger,自定义注解,拦截器,xss过滤,异步调用,定时任务案例 集成swagger--对于做前后端分离的项目,后端只需要提供接口访问,swagger提供了接口 ...

  7. Spring Boot初识(3)- Spring Boot整合Swagger

    一.本文介绍 如果Web项目是完全前后端分离的话(我认为现在完全前后端分离已经是趋势了)一般前端和后端交互都是通过接口的,对接口入参和出参描述的文档就是Mock文档.随着接口数量的增多和参数的个数增加 ...

  8. spring boot+mybatis+swagger搭建

    环境概述 使用的开发工具:idea 2018 3.4 环境:jdk1.8 数据库:MariaDB (10.2.21) 包管理:Maven 3.5 Web容器:Tomcat 8.0 开发机系统:Wind ...

  9. Spring Boot 集成 Swagger 构建接口文档

    在应用开发过程中经常需要对其他应用或者客户端提供 RESTful API 接口,尤其是在版本快速迭代的开发过程中,修改接口的同时还需要同步修改对应的接口文档,这使我们总是做着重复的工作,并且如果忘记修 ...

随机推荐

  1. [SCSS] Write Custom Functions with the SCSS @function Directive

    Writing SCSS @functions is similar to writing functions in other programming languages; they can acc ...

  2. php thinkphp uploadify

    模板文件: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w ...

  3. crx

    https://www.crx4chrome.com/down/770/crx/ Downloading crx file for Linkclump The Linkclump crx file y ...

  4. HTML代码简写法:Emmet和Haml(转)

    HTML代码写起来很费事,因为它的标签多. 一种解决方法是采用模板, 在别人写好的骨架内,填入自己的内容.还有一种就是我今天想要介绍的方法----简写法. 常用的简写法,目前主要是Emmet和Haml ...

  5. 探讨jsp相对路径和绝对路径

    原文链接:http://blog.csdn.net/qq_37936542/article/details/79076768 问题:当在jsp使用相对路径引入其他js文件的时候,通过浏览器访问该页面一 ...

  6. js如何实现动态点击改变单元格颜色?

    js如何实现动态点击改变单元格颜色? 一.总结 1.通过table的rows属性,遍历表格所有行,然后通过cells属性,遍历每一行中的单元格. 2.遍历的过程中,动态的为每一个单元格定义单击事件,改 ...

  7. Ajax请求Session超时的解决办法:拦截器 + 封装jquery的post方法

    目标:前端系统,后端系统等,统一处理Session超时和系统错误的问题. 可能需要处理的问题:Session超时.系统500错误.普通的业务错误.权限不足. 同步请求:            Sess ...

  8. c#代码01--控制台的简单输入与输出及日期的格式输出

    /* 使用ReadLine()完成控制台的输入输出内容 */ using System; namespace Test { class Test1 { static void Main(string[ ...

  9. java phoenix 连接hbase

    <dependency> <groupId>org.apache.phoenix</groupId> <artifactId>phoenix-core& ...

  10. matplotlib plot 绘图函数发生阻塞(block)时的解决方法

    Is there a way to detach matplotlib plots so that the computation can continue? 在一般编辑器中: from matplo ...