http://rapapi.org/org/index.do
Springboot+Gradle+Swagger2构建API:
一、引入依赖
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
testCompile('org.springframework.boot:spring-boot-starter-test')
compile('org.projectlombok:lombok:1.16.16')
compile('org.springframework.boot:spring-boot-starter-data-mongodb')
compile('io.springfox:springfox-swagger2:2.6.1')
compile('io.springfox:springfox-swagger-ui:2.6.1')
}
二、新建配置
@Configuration //表明它是一个配置类
@EnableSwagger2 //开启swagger2
public class Swagger2Config {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())