zoukankan      html  css  js  c++  java
  • 使用Swagger自动生成文档

    1、maven依赖

      maven仓库(https://mvnrepository.com/)搜索springfox

    <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>2.9.2</version>
    </dependency>
    
    <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>2.9.2</version>
    </dependency>

    2、springboot集成swagger2

      1)创建一个springboot项目,pom.xml引入上面贴出的两个依赖jar;

      2)在springboot启动类上加注解@EnableSwagger2;

      3)启动项目,在浏览器输入localhost:8081/swagger-ui.html。

    3、swagger2常用的注解

  • 相关阅读:
    家庭作业有益吗?
    视图、触发器、事务、存储过程、函数
    Navicat使用和pymysql
    表查询
    外键
    MySQL表操作
    进程池线程池、协程
    全局解释器锁及其他用法
    线程
    进程
  • 原文地址:https://www.cnblogs.com/xy-ouyang/p/11074852.html
Copyright © 2011-2022 走看看