springboot使用swagger

博客介绍了Swagger的使用步骤,包括引入jar包、在启动类加注解、配置信息、在controller类里使用注解,还给出了访问地址http://localhost:8088/swagger-ui.html# ,帮助开发者快速上手Swagger。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1引入jar包

<!-- swagger2  didispace封装-->
<dependency>
   <groupId>com.didispace</groupId>
   <artifactId>spring-boot-starter-swagger</artifactId>
   <version>1.3.0.RELEASE</version>
</dependency>

2 启动类加注解

@EnableSwagger2Doc

3 配置信息

swagger: 
  docket:
    demo:  
      title:  系统名称
      description: 系统介绍
      version: 1.1 version
      license: Apache License, Version 2.0
      license-url:
      terms-of-service-url:
      contact:
        name:
        url:  
        email: 
      base-package: com.bao.baoming   # 扫描的基础包,默认:全扫描
      base-path: /**              #需要处理的基础URL规则,默认:/**
      exclude-path: /error,/ops/*  # 需要排除的URL规则,默认:空
 

4 controller类里使用注解

@Api   
@ApiOperation
@ApiImplicitParams

5 访问

http://localhost:8088/swagger-ui.html#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值