SpringBoot整合swagger配置
- 加入pom文件
<!--swagger-->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.19</version>
</dependency>
<dependency>
<groupId>com.spring4all</groupId>
<artifactId>swagger-spring-boot-starter</artifactId>
<version>1.6.0.RELEASE</version>
</dependency>
2.修改application.yml文件
# 配置swagger
swagger:
enabled: true
base-package: com.xx.xx.controller
title: xx-datacenter
version: 1.0.0.SNAPSHOT
description: 后台接口后端服务
contact:
name: shiyi
3.修改启动类
@SpringBootApplication
@EnableScheduling
@EnableSwagger2Doc //加入的swagger注解!!
@ComponentScan("com.ziguang.datacenter")
public class StartApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(StartApplication.class).run(args);
}
}
4.访问网址
http://ip:端口号/swagger-ui.html