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 访问