Springboot Swagger Starter allows to create SpringFox Dockets using Springboot. We make use of SpringFox library, but ban the boilerplate code needed for creation of a Docklet. So instead of providing a @Bean
that returns your Docket, you can just specify it using your properties or YAML file.
Minimal tested versions:
- Spring-Boot 2.3.1.RELEASE
- SpringFox Swagger 3.0.0
Put the following dependency to your Maven POM file:
<dependency>
<groupId>io.toolisticon.springboot</groupId>
<artifactId>springboot-swagger-starter</artifactId>
<version>0.3.0</version>
</dependency>
resp.:
implementation("io.toolisticon.springboot:springboot-swagger-starter:0.3.0")
In your application.yml
add the following block:
swagger:
enabled: true
redirect: true
apiInfo:
title: The Muppet Show API
description: Use this to get a greeting from Muppet Show.
version: 1.0
termsOfService: use on your own risk
lisense: APACHE-2.0
licenseUrl: LICENSE.txt
contact:
name: Miss Piggy
email: [email protected]
url: http://muppetshow.biz
dockets:
muppetShow:
basePackage: "biz.muppetshow.rest"
path: "/show/**"
apiInfo:
title: The Special Muppet Show API
description: Use this to get a greeting from Kermit.
version: 0.1
termsOfService: use on your own risk
lisense: APACHE-2.0
licenseUrl: LICENSE.txt
contact:
name: Kermit The Frog
email: [email protected]
url: http://muppetshow.biz
admin:
basePackage: "biz.muppetshow.admin"
path: "/admin/**"
The library supports configuration of SpringFox Dockets our of application.yml
or application.properties
.
All properties are prefixed with swagger
. Beyond specification of the ApiInfo for every Docket, you can specify a global ApiInfo which will be used for all Dockets, if not overwritten on the Docket level. The following properties are available:
Property | Description | Required | Default | Example |
---|---|---|---|---|
swagger.enabled | Controls if the configuration with properties is enabled. Set to `false` if you want to disable this feature. | yes | true | false |
swagger.redirect | Controls if the request to `/` should be redirected to `swagger-ui/`. | no | false | true |
swagger.apiInfo | API info for all groups. | no | see below | |
swagger.apiInfo.title | Title of the API for all groups. | no | My API | |
swagger.apiInfo.description | Description of the API for all groups. | no | This is a nice API. | |
swagger.apiInfo.version | Version of the API for all groups. | no | 1 | |
swagger.apiInfo.termsOfServiceUrl | Terms of service of the API for all groups. | no | Use on your own risk. | |
swagger.apiInfo.license | License of the API for all groups. | no | APACHE 2.0 | |
swagger.apiInfo.licenseUrl | License url of the API for all groups. | no | http://my.com/license/ | |
swagger.apiInfo.contact.name | Contact name of the API for all groups. | no | Kermit The Frog | |
swagger.apiInfo.contact.email | Contact email of the API for all groups. | no | [email protected] | |
swagger.apiInfo.contact.url | Contact url of the API for all groups. | no | http://muppetshow.biz | |
swagger.dockets | Defines a list of named Docket groups. Every key in this list is a name of the group configures with its elements. | no | empty | see below |
swagger.dockets.[groupname] | Defines a Docket group `groupname`. | no | empty | see below |
...[groupname].apiInfo | API info for this group. | no | see below | |
...[groupname].apiInfo.title | Title of the API for this group. | no | My API | |
...[groupname].apiInfo.description | Description of the API for this group. | no | This is a nice API. | |
...[groupname].apiInfo.version | Version of the API for this group. | no | 1 | |
...[groupname].apiInfo.termsOfServiceUrl | Terms of service of the API for this group. | no | Use on your own risk. | |
...[groupname].apiInfo.license | License of the API for this group. | no | APACHE 2.0 | |
...[groupname].apiInfo.licenseUrl | License url of the API for this group. | no | http://my.com/license/ | |
...[groupname].apiInfo.contact.name | Contact name of the API for this group. | no | Kermit The Frog | |
...[groupname].apiInfo.contact.email | Contact email of the API for this group. | no | [email protected] | |
...[groupname].apiInfo.contact.url | Contact url of the API for this group. | no | http://muppetshow.biz |
We use Kotlin and Maven in this project. Make sure you have a recent Apache Maven Version installed or use mnvw
wrapper.
Run to build:
./mvnw clean install
We are using gitflow to name and manage branches. Pushes on master
branch creates release in OSS nexus.
If you are planing to create one and are allowed to push to the master
branch, please run to create a new version:
./mvnw gitflow:release-start
./mvnw gitflow:release-finish
- 0.3.0 upgrade to springfox 3.0.0
- 0.2.0 upgrade to springboot 2.3.1.RELEASE and JDK 11
- 0.1.0 initial release
https://github.com/toolisticon/springboot-swagger-starter/issues