-
Notifications
You must be signed in to change notification settings - Fork 0
Configure Swagger
Imad laghrissi edited this page Jan 1, 2020
·
1 revision
Welcome to the TutorialHibernatePostgres wiki
- Document API
- Interact with API : Test web service without install other tools like postman, soapUI,...
<!-- swagger dependency -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<!-- swagger dependency to generate html documentation -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
add annotation @EnableSwagger2 of package springfox.documentation.swagger2.annotations in the main class in order to test if it works : http://localhost:8083/v2/api-docs it should return json which describe web services
For web services:
@ApiOperation(value = "View a list of available employee", response = Iterable.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successfully retrieved list"), @ApiResponse(code = 401, message = "You are not authorized to view the resource"), @ApiResponse(code = 403, message = "Accessing the resource you were trying to reach is forbidden"), @ApiResponse(code = 404, message = "The resource you were trying to reach is not found") })
For dto objects:
@ApiModelProperty(notes = "employee id")