Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RestController
- @RequestMapping("/api/products/")
- @Api(value = "ProductControllerApi",produces = MediaType.APPLICATION_JSON_VALUE)
- public class ProductController {
- @PostMapping
- public ResponseEntity<ProductDto> createProduct(@RequestBody Product product) {
- URI location = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}").buildAndExpand(product.getId()).toUri();
- return ResponseEntity.created(location).body(productService.createProduct(product));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement