- 加入pom文件
io.swagger
swagger-annotations
1.5.19
com.spring4all
swagger-spring-boot-starter
1.6.0.RELEASE
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



