How to change the response status code for successful operation in Swagger?

吃可爱长大的小学妹 提交于 2019-12-05 03:01:29

You can add the @ResponseStatus annotation to any a controller method to define the http status it should return. Ex

Adding the following annotation on acontroller method:

@ResponseStatus(code = HttpStatus.CREATED)

Will return a HTTP status 201 (Created)

Adding the following annotation in controller method (method = requestMethod.PUT) or (method = requestMethod.POST) @ResponseStatus (code = HttpStatus.ACCEPTED)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!