1,添加配置类

@Configuration
@EnableSwagger2
@Profile({"default", "dev-online", "test"})
public class SwaggerConfiguration { @Bean
public Docket appDoc() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(appApiInfo())
.directModelSubstitute(Date.class, Double.class)
.directModelSubstitute(LocalDate.class, Double.class)
.select()
.apis(RequestHandlerSelectors.basePackage("com.example.multidatasource.web"))//换成对应应用入口层级
.paths(PathSelectors.any())
.build();
} private ApiInfo appApiInfo() {
return new ApiInfoBuilder()
.title("plan-warehousing 接口文档")
.version("1.0.0")
.build();
} }

2,添加pom文件

<!--swagger支持 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.7.0</version>
</dependency>

3,浏览器访问http://localhost:80/doc.html  服务对应端口号

springboot配置swagger的更多相关文章

  1. SpringBoot配置Swagger实例(POST接收json参数)

    工程目录结构: 首先,引入jar包,只需要以下两个即可 <dependency> <groupId>io.springfox</groupId> <artif ...

  2. springboot 集成swagger ui

    springboot 配置swagger ui 1. 添加依赖 <!-- swagger ui --> <dependency> <groupId>io.sprin ...

  3. 整合 springboot 和 swagger出问题

    整合 springboot 和 swagger ,出现报错, org.springframework.beans.factory.UnsatisfiedDependencyException: Err ...

  4. SpringBoot集成Swagger接口管理工具

    手写Api文档的几个痛点: 文档需要更新的时候,需要再次发送一份给前端,也就是文档更新交流不及时. 接口返回结果不明确 不能直接在线测试接口,通常需要使用工具,比如postman 接口文档太多,不好管 ...

  5. SpringBoot 整合swagger

    springBoot 整合swagger 1.pom.xml 配置 <dependency> <groupId>io.springfox</groupId> < ...

  6. spring-boot 集成 swagger 问题的解决

    spring-boot 集成 swagger 网上有许多关于 spring boot 集成 swagger 的教程.按照教程去做,发现无法打开接口界面. 项目由 spring mvc 迁移过来,是一个 ...

  7. SpringBoot整合Swagger和Actuator

    前言 本篇文章主要介绍的是SpringBoot整合Swagger(API文档生成框架)和SpringBoot整合Actuator(项目监控)使用教程. SpringBoot整合Swagger 说明:如 ...

  8. springboot之swagger快速启动

    springboot之swagger快速启动 简介 介绍 可能大家都有用过swagger,可以通过ui页面显示接口信息,快速和前端进行联调. 没有接触的小伙伴可以参考官网文章进行了解下demo页面. ...

  9. SpringBoot整合Swagger实战

    源码地址:https://github.com/laolunsi/spring-boot-examples 目前SpringBoot常被用于开发Java Web应用,特别是前后端分离项目.为方便前后端 ...

随机推荐

  1. R-shiny服务器安装及配置

    R的shiny 服务器管理-入门http://www.bio-info-trainee.com/1683.html sudo systemctl start shiny-serversudo syst ...

  2. 面试题之python基础

    基础语法 输入和输出 代码中要修改不可变的数据会出现什么问题,抛出什么异常? 代码不会征程运行,抛出TypeError异常 a = 1,b = 2,不用中间变量交换a和b的值? # 方法1 a = a ...

  3. Kuberneteser二进制安装与配置(二)

    环境:Centos7 版本:Kubernetes v1.11.4   一.下载Kubernetes   1)下载 wget https://github.com/kubernetes/kubernet ...

  4. rust

    books--------------Rust 中文教程 RustPrimer http://wiki.jikexueyuan.com/project/rust-primer/any/any.html ...

  5. 学习Python3 天眼查 爬虫

    刚开始学习Python,不愿意看基础,记忆不好,那些语法记不住,直接上个项目,这样比较深刻 刚好公司有个情况要查企业的信息,就想做个爬虫吧,有验证码的不愿意搞,那是个老大难问题,就选择了天眼查 过程都 ...

  6. python爬虫---selenium库的用法

    python爬虫---selenium库的用法 selenium是一个自动化测试工具,支持Firefox,Chrome等众多浏览器 在爬虫中的应用主要是用来解决JS渲染的问题. 1.使用前需要安装这个 ...

  7. abaqus 帮助文档 Substructure(子结构) 理论

    对于静态问题,可以缩减到只保留Retain Node的刚度矩阵和载荷矩阵: 但对于动力问题,还需要增加内部节点作为retain node,但这样会有点麻烦,更为常用的方式是保留子结构的模态和振型.

  8. 浅析MSIL中间语言——基础篇(转)

    来自:https://www.cnblogs.com/dwlsxj/p/MSIL.html 一.开篇 研究MSIL纯属于个人喜好,说在前面MSIL应用于开发的地方很少,但是很大程度上能够帮着我们理解底 ...

  9. 使用密钥登录CentOS系统(基于密钥的认证)

    在Window客户端有多种软件可以登陆ssh,比如putty,xshelll,secureCRT,我就以xshell为例设置使用公钥和私钥验证登陆服务器. 使用Xshell密钥认证机制远程登录Linu ...

  10. flask教程

    http://docs.jinkan.org/docs/flask/ https://dormousehole.readthedocs.io/en/latest/ https://m.w3cschoo ...