title: How to integrate Resilience4j metrics to Micrometer in Camel Spring Boot
body: <p>I am using Camel with Spring Boot and Micrometer. In one of my routes I am using a circuitbreaker with Resilience4j:</p>
  <pre><code>.circuitBreaker()
              .resilience4jConfiguration()
              .timeoutEnabled(true)
              .timeoutDuration(2000)
              .end()
  </code></pre>
  <p>I am using Micrometer managed by Spring. Before moving to resilience4j with Hystrix I could simply bind it to my Micrometer registry:</p>
  <pre><code>@Configuration()
  public class MetricsRegistryBuilder {
      @Bean
      HystrixMetricsBinder registerHystrixMetricsBinder() {
          return new HystrixMetricsBinder();
      }
  }
  </code></pre>
  <p>For Resilience4j there does not exist a binder unfortunately. There is some documentation about how to bind the Resilience4j CircuitBreakerRegistry to Micrometer:
  <a href="https://resilience4j.readme.io/docs/micrometer" rel="nofollow noreferrer">https://resilience4j.readme.io/docs/micrometer</a>
  and also how to do it with Spring:
  <a href="https://resilience4j.readme.io/docs/getting-started-3" rel="nofollow noreferrer">https://resilience4j.readme.io/docs/getting-started-3</a></p>
  <p>I tried to simply autowire the Resilience4j CircuitBreakerRegistry to Micrometer:</p>
  <pre><code>@Configuration()
  public class MetricsRegistryBuilder {
  @Autowired
  private CircuitBreakerRegistry circuitBreakerRegistry;
  }
  </code></pre>
  <p>Unfortunately Spring does not find the CircuitBreakerRegistry Bean.</p>
  <p>Therefore my question is how to bind the CircuitBreakerRegistry, or more abstract the metrics from Resilience4j, to Micrometer when using Camel with Spring?</p>
  <p>The only other possible solution I could think of is to manage all Resilience4j configuration manually, define the beans, and hand it over to my Camel configuration. This though seems to me to a lot of work and boilerplate code considering the simple task of binding my Resilience4j  metrics.</p>
  <p>I am using the following versions:</p>
  <ul>
  <li>Camel 3.4.3</li>
  <li>Spring 2.3.3.RELEASE</li>
  <li>Micormeter 1.5.4</li>
  </ul>
  <p>Also I am using camel spring boot starter dependencies:</p>
  <pre><code>    &lt;dependency&gt;
        &lt;groupId&gt;org.apache.camel.springboot&lt;/groupId&gt;
        &lt;artifactId&gt;camel-micrometer-starter&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.camel.springboot&lt;/groupId&gt;
          &lt;artifactId&gt;camel-resilience4j-starter&lt;/artifactId&gt;
      &lt;/dependency&gt;
  </code></pre>