title: Spring boot how to handle throwable
body: <p>I made a project like this <a href="https://spring.io/guides/gs/spring-boot/" rel="nofollow noreferrer">sample</a>. So the controllers are like this</p>
  
  <pre><code>package mypackagename.controller;
  
  import org.springframework.web.bind.annotation.RestController;
  import org.springframework.web.bind.annotation.RequestMapping;
  
  @RestController
  @RequestMapping("/")
  public class StoresRestController {
  
      @RequestMapping(method = RequestMethod.GET)
      public String stores() {
          return ...
      }
  
  }
  </code></pre>
  
  <p>I like to handle all throwables and make my customized unified response. The problem is I cannot find a guide or a sample to do this correctly. </p>
  
  <p>First of all, I tried <code>ExceptionHandler</code>, with <code>Throwable</code>, but it didn't work, so I decided to move on. Then, the most close approach that I found is <a href="http://www.codingpedia.org/ama/error-handling-in-rest-api-with-jersey/" rel="nofollow noreferrer">this</a>, so I tried jersey, by adding something like <a href="https://stackoverflow.com/a/27985714/2482947">this</a>. But it's not working for all throwables. Also, it's ignoring my controllers, by complaining</p>
  
  <pre><code>o.g.jersey.internal.inject.Providers     : A provider mypackagename.controller.StoresRestController registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime. Due to constraint configuration problems the provider mypackagename.controller.StoresRestController will be ignored. 
  </code></pre>
  
  <p>I searched for this error and found <a href="https://stackoverflow.com/a/19934761/2482947">this</a>, which I'm not using <code>ContainerResponseFilter</code> in my project as I provided the sample above. So I'm clueless. The main problem is how to handle all throwables, but if you can give me some suggestions about how to solve <code>Providers</code> problem, I'll be so appreciated. </p>