title: Spring boot 404 error custom error response ReST
body: <p>I'm using Spring boot for hosting a REST API. Instead of having the standard error response I would like to always send a JSON response even if a browser is accessing the URL and as well a custom data structure. </p>
  
  <p>I can do this with @ControllerAdvice and @ExceptionHandler for custom exceptions. But I can't find any good ways of doing this for standard and handled errors like 404 and 401.</p>
  
  <p>Are there any good patterns of how to do this?</p>