Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.ganity:spring-boot-starter-swagger2:1.0.1'
}
dependencies {
implementation("com.github.ganity:spring-boot-starter-swagger2:1.0.1")
}
<dependency>
<groupId>com.github.ganity</groupId>
<artifactId>spring-boot-starter-swagger2</artifactId>
<version>1.0.1</version>
</dependency>
libraryDependencies += "com.github.ganity" % "spring-boot-starter-swagger2" % "1.0.1"
:dependencies [[com.github.ganity/spring-boot-starter-swagger2 "1.0.1"]]
A spring boot starter with swagger 2.0 api documentation enabled
Base on springfox Swagger2, you can find more information from springfox
git clone the code from github
run the command in your console with maven:
mvn install
pom.xml
<dependency>
<groupId>com.github.ganity</groupId>
<artifactId>spring-boot-starter-swagger2</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
application.yml
or application.properties
swagger:
enable: true #if enable swagger
group: item #the api group name
title: item-title #the title
description: item description
version: v1.10
contact-name: ganily
contact-url: http://www.aaa.com
contact-email: igman@163.com
base-package: video.lark.mall.item.service #the base package for RequestHandlerSelectors default all the package
terms-of-service-url: https://github.com/ganity
license: Apache License Version 2.0
license-url: https://github.com/springfox/springfox/blob/master/LICENSE
http://localhost:8080/springfox/swagger-resources
http://localhost:8080/springfox/swagger-ui.html
http://localhost:8080/springfox/v2/api-docs