Skip to content

Instantly share code, notes, and snippets.

@indrabasak
Last active April 4, 2017 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indrabasak/7dab321b590cea64d89be7a274838733 to your computer and use it in GitHub Desktop.
Save indrabasak/7dab321b590cea64d89be7a274838733 to your computer and use it in GitHub Desktop.
SWAGGER2_INTEGRATION_WITH_SPRING_REST
@Controller
@Api(value = "customers")
public class CustomerServiceController {
...
@ApiOperation(value = "Gets a customer based on customer id",
notes = "Retrieves a single customer", response = Customer.class)
@RequestMapping(method = RequestMethod.GET,
produces = { MediaType.APPLICATION_XML_VALUE,
MediaType.APPLICATION_JSON_VALUE },
value = "customers/{id}")
@ResponseBody
public Customer getCustomer(@PathVariable Integer id) {
Customer customer = service.getCustomer(id);
return customer;
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment