1、加入依赖
<dependency>
<groupId>com.spring4all</groupId>
<artifactId>swagger-spring-boot-starter</artifactId>
<version>1.8.0.RELEASE</version>
</dependency>
2、在启动类上写注解
@SpringBootApplication
@EnableSwagger2Doc
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
3、在application.properties配置文件中写扫描包就搞定了
swagger.base-package=com.yh.controller
4、配置swarger成功后的访问地址就可以使用了:
http://localhost:8080/swagger-ui.html
在maven项目中配置swarger的话,推荐大哥们看下intboy大大的博客,写的很好
https://blog.csdn.net/fengspg/article/details/43705537