springboot--Swagger依赖

依赖说明:

  1.         <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
  2.         <dependency>
  3.             <groupId>io.springfox</groupId>
  4.             <artifactId>springfox-swagger2</artifactId>
  5.             <version>2.9.2</version>
  6.             <!-- Long类型的默认值是字符串,控制台会打印异常,替换为1.5.21版本 -->
  7.             <exclusions>
  8.                 <exclusion>
  9.                     <groupId>io.swagger</groupId>
  10.                     <artifactId>swagger-annotations</artifactId>
  11.                 </exclusion>
  12.                 <exclusion>
  13.                     <groupId>io.swagger</groupId>
  14.                     <artifactId>swagger-models</artifactId>
  15.                 </exclusion>
  16.             </exclusions>
  17.         </dependency>
  18.         <dependency>
  19.             <groupId>io.springfox</groupId>
  20.             <artifactId>springfox-swagger-ui</artifactId>
  21.             <version>2.9.2</version>
  22.         </dependency>
  23.         <dependency>
  24.           <groupId>io.swagger</groupId>
  25.           <artifactId>swagger-annotations</artifactId>
  26.           <version>1.5.21</version>
  27.         </dependency>
  28.         <dependency>
  29.           <groupId>io.swagger</groupId>
  30.           <artifactId>swagger-models</artifactId>
  31.           <version>1.5.21</version>
  32.         </dependency>

        Swagger2比1的版本UI有了很大改善,于是入坑。之所以使用1.5.21的annotations和model,原因是Long类型的数据默认填充的是"",会导致类型转换异常,也可以设置example值
 


版权声明:本文为java_freshman_原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。