swagger导出excel文档_史上最简单的Swagger2实现API文档的静态部署并支持导出PDF并解决中文乱码问题...

简单介绍下Swagger2吧

算了不说了。就是个文档框架,具体的网上一大堆介绍

如何使用

导包

io.springfox

springfox-swagger2

2.8.0

io.springfox

springfox-swagger-ui

2.8.0

加载配置类

package com.eliteai.smartiot.config.swagger;

import org.springframework.beans.factory.annotation.Value;

import org.springframework.context.annotation.Bean;

import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.ApiInfoBuilder;

import springfox.documentation.builders.PathSelectors;

import springfox.documentation.builders.RequestHandlerSelectors;

import springfox.documentation.service.ApiInfo;

import springfox.documentation.spi.DocumentationType;

import springfox.documentation.spring.web.plugins.Docket;

import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**

* Swagger能成为最受欢迎的REST APIs文档生成工具之一,有以下几个原因:

* Swagger 可以生成一个具有互动性的API控制台,开发者可以用来快速学习和尝试API。

* Swagger 可以生成客户端SDK代码用于各种不同的平台上的实现。

* Swagger 文件可以在许多不同的平台上从代码注释中自动生成。

* Swagger 有一个强大的社区,里面有许多强悍的贡献者

*

* @author MR.ZHANG

* @create 2018-09-18 10:06

*/

@Configuration

@EnableSwagger2

public class SwaggerConfig {

private static final String VERSION = "1.0.0";

@Value("${swagger.enable}")

private boolean enableSwagger;

@Bean

public Docket api() {

return new Docket(DocumentationType.SWAGGER_2)

.enable(enableSwagger)

.apiInfo(apiInfo())

.select()

.apis(RequestHandlerSelectors.basePackage("com.eliteai.smartiot.controller"))<

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值