springboot整合swagger配置

SpringBoot整合swagger配置

  1. 加入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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值