title: Is @Recovery method necessary when using Spring-Retry?
body: <p>My question is regarding spring-retry.
  Assume a simple sample code where I have a the Service layer and Controller class.,</p>
  
  <p>This is the testService Interface</p>
  
  <pre><code>public interface testService{
     @Retryable(value = { KnownExceptiomn.class }, backoff = @Backoff(delay = 1000), maxAttempts = 2)
     Address getAddress(String emailAddress);
  }
  </code></pre>
  
  <p>This is the implementation of the service</p>
  
  <pre><code>public class testServiceImpl{
  public Address getAddress(String emailAddress){
     //addressRepository is a crud repository
     return addressRepository.getAddressFromEmail(emailAddress);
     }
  }
  </code></pre>
  
  <p>And the controller is</p>
  
  <pre><code>    @GetMapping("path/{emailId}")
      public ResponseEntity&lt;?&gt; getAddress(@PathVariable("emailId") final String email){
        final Address address;
        try{
          address= testService.getAddress(String emailAddress);
          if(address != null) return new ResponseEntity&lt;Address&gt;(address,HttpStatus.OK);
  
          return new ResponseEntity&lt;String&gt;("Invalid Email", HttpStatus.BAD_REQUEST);
          }catch(KnownException e){
     return errorMessage("Error");
         }
  
  }
  </code></pre>
  
  <p>As seen the @Retryble is in the Service interface. However I have not implemented an @Recover method. My thought here was since i dont really have any secondary DB and If the DB is down there really isn't a recovery option I did not add a @Recovery method. Instead the exception was caught in the controller and handled.</p>
  
  <p>My questions are: </p>
  
  <ol>
  <li>Is the above approach wrong. If so, how to do it the right way?</li>
  <li>Is it always necessary to have a recovery method? If so what would be recovery in these kind of scenarios like DB being down and no alternative source of Data. </li>
  <li><p>Is it wrong to catch exceptions in controller and handle
  them accordingly? (I was told the service lay should handle all the
  exceptions in some discussions).</p>
  
  <p>Everywhere I've see is some sort of recovery method but couldn't find a solid example with proper recovery handler for this type of scenario if there is. </p></li>
  </ol>