title: resilience4j circuit breaker change fallback method return type than actual called method return type
body: <p>I am trying to learn Spring Boot microservices. Now I am trying to implement circuit breaker with resilience4j if any of my called service is off.</p>
  <p>If I set the fallback method return type as like the actual method return type than it works fine but I can't show the information that my service is off. Because it then send the response null in object's fields. But if I change the return type to String on actual method and also in fallback then I will not be able to get the object value as JSON.</p>
  <p>Is it possible to return as string something like <code>Branch service is down!..</code> with my fallback method and if OK then get the object value as JSON from actual called method? My attempts are below:</p>
  <p>My controller method:</p>
  <pre><code>@GetMapping(&quot;/getById/{id}&quot;)
  @CircuitBreaker(name = &quot;default&quot;, fallbackMethod = &quot;employeeFallback&quot;)
  public ResponseModelEmployee getEmployee(@PathVariable(&quot;id&quot;) Long id) {
      return employeeService.findByEmployeeId(id);
  }
  </code></pre>
  <p>My fallback method in controller:</p>
  <pre><code>public ResponseModelEmployee employeeFallback(Long id, Exception ex) {
          return new ResponseModelEmployee();
      }
  </code></pre>
  <p>My service method called from controller:</p>
  <pre><code>public ResponseModelEmployee findByEmployeeId(Long id) {
          ResponseModelEmployee empDetails = new ResponseModelEmployee();
          ...
          Branch branch = restTemplate.getForObject(&quot;http://BRANCH-SERVICE/branch/getById/&quot; +
                  employee.get().getBranchId(),
                  Branch.class);
  
          ...
  
          return empDetails;
      }
  </code></pre>
  <p>My desire method as fallback:</p>
  <pre><code>public String employeeFallback(Long id, Exception ex) {
          return &quot;Branch Service is down&quot;;
      }
  </code></pre>
  <p>If I set my desire method for fallback then it gives the following error:</p>
  <p><code>java.lang.NoSuchMethodException: class com.example.employee.VO.ResponseModelEmployee class com.example.employee.controller.EmployeeController.employeeFallback(class java.lang.Long,class java.lang.Throwable) at io.github.resilience4j.fallback.FallbackMethod.create(FallbackMethod.java:92) ~[resilience4j-spring-1.7.0.jar:1.7.0] ....</code></p>