Spring Boot Kafka Consumer throwing No bean named 'kafkaListenerContainerFactory' available












1















pom.xml



<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.mobicule</groupId>
<artifactId>spring-boot-kafka-consumer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>spring-boot-kafka-consumer</name>
<description>Demo project for Spring Boot</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>


</project>


KafkaConfiguration.java



package com.mobicule.springbootkafkaconsumer.config;

import java.util.HashMap;
import java.util.Map;

import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.annotation.EnableKafka;
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
import org.springframework.kafka.core.ConsumerFactory;
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;

@EnableKafka
@Configuration
public class KafkaConfiguration {

@Bean
public ConsumerFactory<String, String> consumerFactory()
{
Map<String, Object> config = new HashMap<String, Object>();

config.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
config.put(ConsumerConfig.GROUP_ID_CONFIG, "group_id");
config.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
config.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);


return new DefaultKafkaConsumerFactory<String, String>(config);
}

@Bean
public ConcurrentKafkaListenerContainerFactory<String, String> kafkaConsumerFactory()
{
ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<String, String>();

factory.setConsumerFactory(consumerFactory());
return factory;
}



}


KafkaConsumer.java



package com.mobicule.springbootkafkaconsumer.listener;

import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class KafkaConsumer {

@KafkaListener(topics="ConsumerDemo",groupId="group_id")
public void consume(String message)
{
System.out.println("In kafka consumer "+message);
}

}


I have configured Basic Kafka Producer project using Spring Initializer (without server)



1) I produced a message "Hello World" on topic "ConsumerConfig" using terminal

Then when i executed my consumer project i got error as



The following candidates were found but could not be injected:
- Bean method 'kafkaConsumerFactory' in 'KafkaAutoConfiguration' not loaded because @ConditionalOnMissingBean (types: org.springframework.kafka.core.ConsumerFactory; SearchStrategy: all) found beans of type 'org.springframework.kafka.core.ConsumerFactory' consumerFactory
- User-defined bean method 'consumerFactory' in 'KafkaConfiguration'


Action:

Consider revisiting the entries above or defining a bean of type 'org.springframework.kafka.core.ConsumerFactory' in your configuration.


So i searched and i got a link which said put
@SpringBootApplication(exclude = KafkaAutoConfiguration.class)



Even after putting the above in my code i got an error as

Description:



A component required a bean named 'kafkaListenerContainerFactory' that could not be found.


Action:

Consider defining a bean named 'kafkaListenerContainerFactory' in your configuration.


What am i missing here ? Do i need to do anymore configurations?










share|improve this question



























    1















    pom.xml



    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mobicule</groupId>
    <artifactId>spring-boot-kafka-consumer</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>spring-boot-kafka-consumer</name>
    <description>Demo project for Spring Boot</description>

    <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.0.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    </properties>

    <dependencies>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
    </dependency>
    <dependency>
    <groupId>org.springframework.kafka</groupId>
    <artifactId>spring-kafka</artifactId>
    </dependency>

    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
    </dependency>
    </dependencies>

    <build>
    <plugins>
    <plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    </plugin>
    </plugins>
    </build>


    </project>


    KafkaConfiguration.java



    package com.mobicule.springbootkafkaconsumer.config;

    import java.util.HashMap;
    import java.util.Map;

    import org.apache.kafka.clients.consumer.ConsumerConfig;
    import org.apache.kafka.common.serialization.StringDeserializer;
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.Configuration;
    import org.springframework.kafka.annotation.EnableKafka;
    import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
    import org.springframework.kafka.core.ConsumerFactory;
    import org.springframework.kafka.core.DefaultKafkaConsumerFactory;

    @EnableKafka
    @Configuration
    public class KafkaConfiguration {

    @Bean
    public ConsumerFactory<String, String> consumerFactory()
    {
    Map<String, Object> config = new HashMap<String, Object>();

    config.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
    config.put(ConsumerConfig.GROUP_ID_CONFIG, "group_id");
    config.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
    config.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);


    return new DefaultKafkaConsumerFactory<String, String>(config);
    }

    @Bean
    public ConcurrentKafkaListenerContainerFactory<String, String> kafkaConsumerFactory()
    {
    ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<String, String>();

    factory.setConsumerFactory(consumerFactory());
    return factory;
    }



    }


    KafkaConsumer.java



    package com.mobicule.springbootkafkaconsumer.listener;

    import org.springframework.kafka.annotation.KafkaListener;
    import org.springframework.stereotype.Component;

    @Component
    public class KafkaConsumer {

    @KafkaListener(topics="ConsumerDemo",groupId="group_id")
    public void consume(String message)
    {
    System.out.println("In kafka consumer "+message);
    }

    }


    I have configured Basic Kafka Producer project using Spring Initializer (without server)



    1) I produced a message "Hello World" on topic "ConsumerConfig" using terminal

    Then when i executed my consumer project i got error as



    The following candidates were found but could not be injected:
    - Bean method 'kafkaConsumerFactory' in 'KafkaAutoConfiguration' not loaded because @ConditionalOnMissingBean (types: org.springframework.kafka.core.ConsumerFactory; SearchStrategy: all) found beans of type 'org.springframework.kafka.core.ConsumerFactory' consumerFactory
    - User-defined bean method 'consumerFactory' in 'KafkaConfiguration'


    Action:

    Consider revisiting the entries above or defining a bean of type 'org.springframework.kafka.core.ConsumerFactory' in your configuration.


    So i searched and i got a link which said put
    @SpringBootApplication(exclude = KafkaAutoConfiguration.class)



    Even after putting the above in my code i got an error as

    Description:



    A component required a bean named 'kafkaListenerContainerFactory' that could not be found.


    Action:

    Consider defining a bean named 'kafkaListenerContainerFactory' in your configuration.


    What am i missing here ? Do i need to do anymore configurations?










    share|improve this question

























      1












      1








      1








      pom.xml



      <?xml version="1.0" encoding="UTF-8"?>
      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>

      <groupId>com.mobicule</groupId>
      <artifactId>spring-boot-kafka-consumer</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <packaging>jar</packaging>

      <name>spring-boot-kafka-consumer</name>
      <description>Demo project for Spring Boot</description>

      <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>2.1.0.RELEASE</version>
      <relativePath/> <!-- lookup parent from repository -->
      </parent>

      <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
      <java.version>1.8</java.version>
      </properties>

      <dependencies>
      <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
      </dependency>
      <dependency>
      <groupId>org.springframework.kafka</groupId>
      <artifactId>spring-kafka</artifactId>
      </dependency>

      <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
      </dependency>
      </dependencies>

      <build>
      <plugins>
      <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
      </plugins>
      </build>


      </project>


      KafkaConfiguration.java



      package com.mobicule.springbootkafkaconsumer.config;

      import java.util.HashMap;
      import java.util.Map;

      import org.apache.kafka.clients.consumer.ConsumerConfig;
      import org.apache.kafka.common.serialization.StringDeserializer;
      import org.springframework.context.annotation.Bean;
      import org.springframework.context.annotation.Configuration;
      import org.springframework.kafka.annotation.EnableKafka;
      import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
      import org.springframework.kafka.core.ConsumerFactory;
      import org.springframework.kafka.core.DefaultKafkaConsumerFactory;

      @EnableKafka
      @Configuration
      public class KafkaConfiguration {

      @Bean
      public ConsumerFactory<String, String> consumerFactory()
      {
      Map<String, Object> config = new HashMap<String, Object>();

      config.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
      config.put(ConsumerConfig.GROUP_ID_CONFIG, "group_id");
      config.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
      config.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);


      return new DefaultKafkaConsumerFactory<String, String>(config);
      }

      @Bean
      public ConcurrentKafkaListenerContainerFactory<String, String> kafkaConsumerFactory()
      {
      ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<String, String>();

      factory.setConsumerFactory(consumerFactory());
      return factory;
      }



      }


      KafkaConsumer.java



      package com.mobicule.springbootkafkaconsumer.listener;

      import org.springframework.kafka.annotation.KafkaListener;
      import org.springframework.stereotype.Component;

      @Component
      public class KafkaConsumer {

      @KafkaListener(topics="ConsumerDemo",groupId="group_id")
      public void consume(String message)
      {
      System.out.println("In kafka consumer "+message);
      }

      }


      I have configured Basic Kafka Producer project using Spring Initializer (without server)



      1) I produced a message "Hello World" on topic "ConsumerConfig" using terminal

      Then when i executed my consumer project i got error as



      The following candidates were found but could not be injected:
      - Bean method 'kafkaConsumerFactory' in 'KafkaAutoConfiguration' not loaded because @ConditionalOnMissingBean (types: org.springframework.kafka.core.ConsumerFactory; SearchStrategy: all) found beans of type 'org.springframework.kafka.core.ConsumerFactory' consumerFactory
      - User-defined bean method 'consumerFactory' in 'KafkaConfiguration'


      Action:

      Consider revisiting the entries above or defining a bean of type 'org.springframework.kafka.core.ConsumerFactory' in your configuration.


      So i searched and i got a link which said put
      @SpringBootApplication(exclude = KafkaAutoConfiguration.class)



      Even after putting the above in my code i got an error as

      Description:



      A component required a bean named 'kafkaListenerContainerFactory' that could not be found.


      Action:

      Consider defining a bean named 'kafkaListenerContainerFactory' in your configuration.


      What am i missing here ? Do i need to do anymore configurations?










      share|improve this question














      pom.xml



      <?xml version="1.0" encoding="UTF-8"?>
      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>

      <groupId>com.mobicule</groupId>
      <artifactId>spring-boot-kafka-consumer</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <packaging>jar</packaging>

      <name>spring-boot-kafka-consumer</name>
      <description>Demo project for Spring Boot</description>

      <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>2.1.0.RELEASE</version>
      <relativePath/> <!-- lookup parent from repository -->
      </parent>

      <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
      <java.version>1.8</java.version>
      </properties>

      <dependencies>
      <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
      </dependency>
      <dependency>
      <groupId>org.springframework.kafka</groupId>
      <artifactId>spring-kafka</artifactId>
      </dependency>

      <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
      </dependency>
      </dependencies>

      <build>
      <plugins>
      <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
      </plugins>
      </build>


      </project>


      KafkaConfiguration.java



      package com.mobicule.springbootkafkaconsumer.config;

      import java.util.HashMap;
      import java.util.Map;

      import org.apache.kafka.clients.consumer.ConsumerConfig;
      import org.apache.kafka.common.serialization.StringDeserializer;
      import org.springframework.context.annotation.Bean;
      import org.springframework.context.annotation.Configuration;
      import org.springframework.kafka.annotation.EnableKafka;
      import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
      import org.springframework.kafka.core.ConsumerFactory;
      import org.springframework.kafka.core.DefaultKafkaConsumerFactory;

      @EnableKafka
      @Configuration
      public class KafkaConfiguration {

      @Bean
      public ConsumerFactory<String, String> consumerFactory()
      {
      Map<String, Object> config = new HashMap<String, Object>();

      config.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
      config.put(ConsumerConfig.GROUP_ID_CONFIG, "group_id");
      config.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
      config.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);


      return new DefaultKafkaConsumerFactory<String, String>(config);
      }

      @Bean
      public ConcurrentKafkaListenerContainerFactory<String, String> kafkaConsumerFactory()
      {
      ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<String, String>();

      factory.setConsumerFactory(consumerFactory());
      return factory;
      }



      }


      KafkaConsumer.java



      package com.mobicule.springbootkafkaconsumer.listener;

      import org.springframework.kafka.annotation.KafkaListener;
      import org.springframework.stereotype.Component;

      @Component
      public class KafkaConsumer {

      @KafkaListener(topics="ConsumerDemo",groupId="group_id")
      public void consume(String message)
      {
      System.out.println("In kafka consumer "+message);
      }

      }


      I have configured Basic Kafka Producer project using Spring Initializer (without server)



      1) I produced a message "Hello World" on topic "ConsumerConfig" using terminal

      Then when i executed my consumer project i got error as



      The following candidates were found but could not be injected:
      - Bean method 'kafkaConsumerFactory' in 'KafkaAutoConfiguration' not loaded because @ConditionalOnMissingBean (types: org.springframework.kafka.core.ConsumerFactory; SearchStrategy: all) found beans of type 'org.springframework.kafka.core.ConsumerFactory' consumerFactory
      - User-defined bean method 'consumerFactory' in 'KafkaConfiguration'


      Action:

      Consider revisiting the entries above or defining a bean of type 'org.springframework.kafka.core.ConsumerFactory' in your configuration.


      So i searched and i got a link which said put
      @SpringBootApplication(exclude = KafkaAutoConfiguration.class)



      Even after putting the above in my code i got an error as

      Description:



      A component required a bean named 'kafkaListenerContainerFactory' that could not be found.


      Action:

      Consider defining a bean named 'kafkaListenerContainerFactory' in your configuration.


      What am i missing here ? Do i need to do anymore configurations?







      spring-boot apache-kafka spring-kafka






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 15 '18 at 12:31









      Ajinkya KarodeAjinkya Karode

      347




      347
























          1 Answer
          1






          active

          oldest

          votes


















          1














          If you use Spring Boot, you don't need that custom ConsumerFactory, neither ConcurrentKafkaListenerContainerFactory. You should fully rely on the auto-configuration and appropriate configuration properties from the spring.kafka namespace: https://docs.spring.io/spring-boot/docs/2.1.0.RELEASE/reference/htmlsingle/#boot-features-kafka



          If you still insist to exclude KafkaAutoConfiguration and do everything manually, you really need to name your ConcurrentKafkaListenerContainerFactory with the requested kafkaListenerContainerFactory bean name: https://docs.spring.io/spring-kafka/docs/2.2.0.RELEASE/reference/html/_reference.html#kafka-listener-annotation






          share|improve this answer
























          • I referred an youtube video :- youtube.com/watch?v=IncG0_XSSBg . In that video he has defined custom Consumerfactory and ConcurrentKafkaListenerContainerFactory .It worked , why not mine ?

            – Ajinkya Karode
            Nov 16 '18 at 7:27













          • The difference is here in there @KafkaListener annotation: containerFactory() - <p>If not specified, the default container factory is used, if any.

            – Artem Bilan
            Nov 16 '18 at 16:50











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53319590%2fspring-boot-kafka-consumer-throwing-no-bean-named-kafkalistenercontainerfactory%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          If you use Spring Boot, you don't need that custom ConsumerFactory, neither ConcurrentKafkaListenerContainerFactory. You should fully rely on the auto-configuration and appropriate configuration properties from the spring.kafka namespace: https://docs.spring.io/spring-boot/docs/2.1.0.RELEASE/reference/htmlsingle/#boot-features-kafka



          If you still insist to exclude KafkaAutoConfiguration and do everything manually, you really need to name your ConcurrentKafkaListenerContainerFactory with the requested kafkaListenerContainerFactory bean name: https://docs.spring.io/spring-kafka/docs/2.2.0.RELEASE/reference/html/_reference.html#kafka-listener-annotation






          share|improve this answer
























          • I referred an youtube video :- youtube.com/watch?v=IncG0_XSSBg . In that video he has defined custom Consumerfactory and ConcurrentKafkaListenerContainerFactory .It worked , why not mine ?

            – Ajinkya Karode
            Nov 16 '18 at 7:27













          • The difference is here in there @KafkaListener annotation: containerFactory() - <p>If not specified, the default container factory is used, if any.

            – Artem Bilan
            Nov 16 '18 at 16:50
















          1














          If you use Spring Boot, you don't need that custom ConsumerFactory, neither ConcurrentKafkaListenerContainerFactory. You should fully rely on the auto-configuration and appropriate configuration properties from the spring.kafka namespace: https://docs.spring.io/spring-boot/docs/2.1.0.RELEASE/reference/htmlsingle/#boot-features-kafka



          If you still insist to exclude KafkaAutoConfiguration and do everything manually, you really need to name your ConcurrentKafkaListenerContainerFactory with the requested kafkaListenerContainerFactory bean name: https://docs.spring.io/spring-kafka/docs/2.2.0.RELEASE/reference/html/_reference.html#kafka-listener-annotation






          share|improve this answer
























          • I referred an youtube video :- youtube.com/watch?v=IncG0_XSSBg . In that video he has defined custom Consumerfactory and ConcurrentKafkaListenerContainerFactory .It worked , why not mine ?

            – Ajinkya Karode
            Nov 16 '18 at 7:27













          • The difference is here in there @KafkaListener annotation: containerFactory() - <p>If not specified, the default container factory is used, if any.

            – Artem Bilan
            Nov 16 '18 at 16:50














          1












          1








          1







          If you use Spring Boot, you don't need that custom ConsumerFactory, neither ConcurrentKafkaListenerContainerFactory. You should fully rely on the auto-configuration and appropriate configuration properties from the spring.kafka namespace: https://docs.spring.io/spring-boot/docs/2.1.0.RELEASE/reference/htmlsingle/#boot-features-kafka



          If you still insist to exclude KafkaAutoConfiguration and do everything manually, you really need to name your ConcurrentKafkaListenerContainerFactory with the requested kafkaListenerContainerFactory bean name: https://docs.spring.io/spring-kafka/docs/2.2.0.RELEASE/reference/html/_reference.html#kafka-listener-annotation






          share|improve this answer













          If you use Spring Boot, you don't need that custom ConsumerFactory, neither ConcurrentKafkaListenerContainerFactory. You should fully rely on the auto-configuration and appropriate configuration properties from the spring.kafka namespace: https://docs.spring.io/spring-boot/docs/2.1.0.RELEASE/reference/htmlsingle/#boot-features-kafka



          If you still insist to exclude KafkaAutoConfiguration and do everything manually, you really need to name your ConcurrentKafkaListenerContainerFactory with the requested kafkaListenerContainerFactory bean name: https://docs.spring.io/spring-kafka/docs/2.2.0.RELEASE/reference/html/_reference.html#kafka-listener-annotation







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 15 '18 at 14:24









          Artem BilanArtem Bilan

          66.8k84972




          66.8k84972













          • I referred an youtube video :- youtube.com/watch?v=IncG0_XSSBg . In that video he has defined custom Consumerfactory and ConcurrentKafkaListenerContainerFactory .It worked , why not mine ?

            – Ajinkya Karode
            Nov 16 '18 at 7:27













          • The difference is here in there @KafkaListener annotation: containerFactory() - <p>If not specified, the default container factory is used, if any.

            – Artem Bilan
            Nov 16 '18 at 16:50



















          • I referred an youtube video :- youtube.com/watch?v=IncG0_XSSBg . In that video he has defined custom Consumerfactory and ConcurrentKafkaListenerContainerFactory .It worked , why not mine ?

            – Ajinkya Karode
            Nov 16 '18 at 7:27













          • The difference is here in there @KafkaListener annotation: containerFactory() - <p>If not specified, the default container factory is used, if any.

            – Artem Bilan
            Nov 16 '18 at 16:50

















          I referred an youtube video :- youtube.com/watch?v=IncG0_XSSBg . In that video he has defined custom Consumerfactory and ConcurrentKafkaListenerContainerFactory .It worked , why not mine ?

          – Ajinkya Karode
          Nov 16 '18 at 7:27







          I referred an youtube video :- youtube.com/watch?v=IncG0_XSSBg . In that video he has defined custom Consumerfactory and ConcurrentKafkaListenerContainerFactory .It worked , why not mine ?

          – Ajinkya Karode
          Nov 16 '18 at 7:27















          The difference is here in there @KafkaListener annotation: containerFactory() - <p>If not specified, the default container factory is used, if any.

          – Artem Bilan
          Nov 16 '18 at 16:50





          The difference is here in there @KafkaListener annotation: containerFactory() - <p>If not specified, the default container factory is used, if any.

          – Artem Bilan
          Nov 16 '18 at 16:50




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53319590%2fspring-boot-kafka-consumer-throwing-no-bean-named-kafkalistenercontainerfactory%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Bressuire

          Vorschmack

          Quarantine