Error controlling the error message

0

I am creating an error in the controller with Spring and it turns out that when I return the request with Postman it gives me an error of "N".

Unexpected 'N'

The code that I have below:

@RestController
public class CustomerController {

    @Autowired
    private CustomerService customerService;

    @RequestMapping(value = "/{firstName}", method = RequestMethod.GET,produces="application/json;charset=UTF-8")
    public ResponseEntity<Customer> showMessage(@PathVariable("firstName") String firstName)  {
        Customer persona = customerService.findCustomerByName(firstName);
        if (persona == null) {
            return new ResponseEntity("Not find a customer",HttpStatus.NOT_FOUND);
        }
        return new ResponseEntity<Customer>(persona, HttpStatus.OK);
    }   
}

Why is this exception returned?

    
asked by jc1992 17.08.2018 в 23:10
source

0 answers