@RequestMapping(method = RequestMethod.POST)
  public T save(@RequestBody @Valid T t, BindingResult result) throws Exception {

    if (result.hasErrors()) {
      throw new BadRequestException(result);
    }
    return service.save(t);
  }
 @RequestMapping(method = RequestMethod.DELETE, value = "/{id}")
 public void delete(@PathVariable String id) {
   service.delete(id);
 }
 @RequestMapping(method = RequestMethod.GET, value = "/list")
 public Page<T> find(Pageable pageRequest, Principal principal) {
   logger.debug("Customer page requested by user {}", principal);
   return service.find(pageRequest);
 }
 @RequestMapping(method = RequestMethod.GET, value = "/{id}")
 public T find(@PathVariable String id) {
   return service.find(id);
 }