/**
* Get customer using id. Returns HTTP 404 if customer not found
*
* @param customerId a {@link java.lang.Long} object.
* @return retrieved customer
* @throws com.poc.restfulpoc.exception.EntityNotFoundException if any.
*/
@GetMapping(value = "/rest/customers/{customerId}", produces = {
MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
public ResponseEntity<Customer> getCustomer(
@PathVariable("customerId") @NotBlank Long customerId)
throws EntityNotFoundException {
log.info("Fetching Customer with id {}", customerId);
final Customer user = customerService.getCustomer(customerId);
if (user == null) {
log.error("Customer with id {} not found", customerId);
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
return new ResponseEntity<>(user, HttpStatus.OK);
}
CustomerController.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:POC
作者:
评论列表
文章目录