Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. @RestController
  2. @RequestMapping("/api/products/")
  3. @Api(value = "ProductControllerApi",produces = MediaType.APPLICATION_JSON_VALUE)
  4. public class ProductController {
  5. @PostMapping
  6. public ResponseEntity<ProductDto> createProduct(@RequestBody Product product) {
  7. URI location = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}").buildAndExpand(product.getId()).toUri();
  8. return ResponseEntity.created(location).body(productService.createProduct(product));
  9. }
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement