title: Spring Kafka Test with Confluent Kafka Avro Serializer cannot find ZKClientConfig
body: <p>I struggle with starting embedded Kafka for intergration testing. This error is displayed:</p>
  
  <blockquote>
    <p>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedKafka': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/zookeeper/client/ZKClientConfig</p>
  </blockquote>
  
  <p>This is my minimal sample. I need to use <code>@ExtendWith(SpringExtension.class)</code> as long as I need to autowire further Spring beans.</p>
  
  <pre><code>@ExtendWith(SpringExtension.class)
  @EmbeddedKafka(
          partitions = 1,
          bootstrapServersProperty = "spring.kafka.bootstrap-servers")
  public class KafkaTest {
  
      @Test
      public void test(EmbeddedKafkaBroker broker) {
          var brokerList = broker.getBrokersAsString();
          log.debug("Embedded Kakfa topics {}", broker.getTopics());
      }
  }
  </code></pre>
  
  <p>I use:</p>
  
  <ul>
  <li>Java 11</li>
  <li>Spring Boot 2.3</li>
  <li>jUnit 5</li>
  </ul>
  
  <p>My guess the dependency inconsistence takes the place here, however, it is weird since I believe Spring Boot parent can achieve the dependencies compatibility.</p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;2.3.0.RELEASE&lt;/version&gt;
      &lt;relativePath/&gt;
  &lt;/parent&gt;
  </code></pre>
  
  <p>For sure, I list related dependencies in <strong>pom.xml</strong> below:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.kafka&lt;/groupId&gt;
      &lt;artifactId&gt;spring-kafka&lt;/artifactId&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;io.confluent&lt;/groupId&gt;
      &lt;artifactId&gt;kafka-avro-serializer&lt;/artifactId&gt;
      &lt;version&gt;5.2.3&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;!-- TEST SCOPE --&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.junit.jupiter&lt;/groupId&gt;
      &lt;artifactId&gt;junit-jupiter-engine&lt;/artifactId&gt;
      &lt;version&gt;5.6.2&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
      &lt;scope&gt;test&lt;/scope&gt;
      &lt;exclusions&gt;
          &lt;exclusion&gt;
              &lt;groupId&gt;org.junit.vintage&lt;/groupId&gt;
              &lt;artifactId&gt;junit-vintage-engine&lt;/artifactId&gt;
          &lt;/exclusion&gt;
      &lt;/exclusions&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.kafka&lt;/groupId&gt;
      &lt;artifactId&gt;spring-kafka-test&lt;/artifactId&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>I tried to exclude <code>org.apache.kafka:kafka-clients</code> in both <code>org.springframework.kafka:spring-kafka-test</code> and <code>io.confluent:kafka-avro-serializer</code> with no luck and the same error ocurred.</p>
  
  <pre><code>&lt;exclusion&gt;
      &lt;groupId&gt;org.apache.kafka&lt;/groupId&gt;
      &lt;artifactId&gt;kafka-clients&lt;/artifactId&gt;
  &lt;/exclusion&gt;
  </code></pre>