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. WEB应用图片的格式,以及各自的特点和优化(一) by FungLeo

    WEB应用图片的格式,以及各自的特点和优化(一) by FungLeo 前言 12年前我入行三天.用table布局做了一个非常粗糙的网页.我说了一句话,"网页就是表格加文字加图片,图片分两种 ...

  2. LinearLayout的一些注意事项 分类: H1_ANDROID 2013-10-26 23:01 856人阅读 评论(0) 收藏

    1.orientation的默认值为horizontal,即从左向右排列.由于一般从上向下排列,所以必须指定orientation属性. 2.layout_gravity与gravity的区别: (1 ...

  3. ConcurrentHashMap 内部实现分析

    ConcurrentHashMap ConcurrentHashMap是一个线程安全的Hash Table,它的主要功能是提供了一组和HashTable功能相同但是线程安全的方法.Concurrent ...

  4. 【24.91】【Tsinsen 1302】&【BZOJ 2626】JZPFAR

    时间限制:5.0s   内存限制:256.0MB   总提交次数:547   AC次数:137   平均分:40.31 将本题分享到:        查看未格式化的试题   提交   试题讨论 试题来 ...

  5. 封装springmvc处理ajax请求结果

    原文链接:http://blog.csdn.net/qq_37936542/article/details/79064818 需求描述:ajax向后台发起请求,springmvc在处理完请求后返回的结 ...

  6. [Grid Layout] Place grid items on a grid using grid-column and grid-row

    It’s possible to position a grid item anywhere on a grid track. To do this, let’s specify some grid- ...

  7. Android View框架的measure机制

    概述 Android中View框架的工作机制中,主要有三个过程: 1.View树的測量(measure)Android View框架的measure机制 2.View树的布局(layout) Andr ...

  8. Erlang与ActionScript3采用JSON格式进行Socket通讯

    http://hideto.iteye.com/blog/235811 需要下载as3corelib来为ActionScript3处理JSON codec server.erl -module(ser ...

  9. NOIP2015 运输计划 - 二分 + 树链剖分 / (倍增 + 差分)

    BZOJ CodeVS Uoj 题目大意: 给一个n个点的边带权树,给定m条链,你可以选择树中的任意一条边,将它置为0,使得最长的链长最短. 题目分析: 最小化最大值,二分. 二分最短长度mid,将图 ...

  10. Eclipse迅速执行:Exception in thread &quot;main&quot; java.lang.OutOfMemoryError: Java heap space

    问题叙述性说明: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space 问题原因: 程序中对 ...