第一步加入依赖
<dependency> <groupId>io.swagger</groupId> <artifactId>swagger-annotations</artifactId> <version>1.5.13</version> <scope>compile</scope> </dependency>
第二步
创建swagger核心配置类
第三步
在SpringBoot主启动类上加入@ComponentScan(basePackagea= {"要扫描的包名"})
第四步
启动SpringBoot工程,启动成功后访问http://localhost:你的端口号/swagger-ui.html
如成功出现以下画面即成功配置swagger