@Target(value=TYPE) @Retention(value=RUNTIME) @Documented @Import(value=SwaggerConfig.class) @EnableConfigurationProperties(value=AppConfigurationProperties.class) @AutoConfigureAfter(value=AppConfigurationProperties.class) public @interface AutoConfigureSwagger
需要添加的依赖:
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
需要添加或修改的配置文件
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
springfox:
documentation:
swagger-ui:
base-url: /api/swagger
open-api:
v3:
path: /api/swagger/v3/api-docs
app:
# SwaggerUI配置
swagger:
# Swagger接口扫描的java包地址
base-package: com.xxx.controller
# SwaggerUI生效的spring配置
profiles:
- dev
- test
# 标题
title: "Demo System API Documentation"
# license
license:
name: MIT License
url: https://github.com/hetianyi
# 说明
description: 演示系统接口开发文档
# 版本
version: ${app.version:0.0.1}
# 接口全局参数定义
global-parameters:
- name: sessionid
place: query
required: true
protocols:
- http
- https
termsOfServiceUrl: https://github.com/
contact:
name: Jason He
email: hehety@outlook.com
url: https://github.com/hetianyi
apiKey:
name: token
keyName: X-AUTH-TOKEN
passAs: header
Copyright © 2022. All rights reserved.