使用国人写的com.spring4all的方式
依赖
<dependency>
<groupId>com.spring4all</groupId>
<artifactId>swagger-spring-boot-starter</artifactId>
<version>1.9.1.RELEASE</version>
</dependency>
在启动类上增加注解
@EnableSwagger2Doc
yml
#swagger配置
swagger:
enable: true
title: OSS服务
description: OSS基础服务API
version: ${project.version}
base-package: com.shoukailiang.it_community
base-path: /**
exclude-path: /error
authorization:
key-name: Authorization
@GetMapping("/a")
@ApiOperation(value ="获取accesskey" )
public String search() {
AliyunProperties aliyunProperties = articleProperties.getAliyun();
return aliyunProperties.getAccessKeyId();
}