bootstrap.yml文件配置丢失kafkaProducer引起错误

bootstrap.yml文件配置丢失kafkaProducer引起错误:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
    [2019-09-05 13:56:08] [ERROR][org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter:42]-- 
    
    ***************************
    APPLICATION FAILED TO START
    ***************************
    
    Description:
    
    Field kafkaProducer in com.tsp.front.service.common.KafkaCallBackProducer required a bean of type 'org.apache.kafka.clients.producer.KafkaProducer' that could not be found.
    
    The injection point has the following annotations:
    	- @org.springframework.beans.factory.annotation.Autowired(required=true)
    
    The following candidates were found but could not be injected:
    	- Bean method 'producer' in 'KafkaAutoConfiguration' not loaded because @ConditionalOnProperty (spring.kafka.bootstrapServers) did not find property 'spring.kafka.bootstrapServers'
    
    
    Action:
    
    Consider revisiting the entries above or defining a bean of type 'org.apache.kafka.clients.producer.KafkaProducer' in your configuration.

原因:bootstrap.yml中的Spring缺少kafka配置:

bootstrap.yml文件配置丢失kafkaProducer引起错误_第1张图片

你可能感兴趣的:(kafka)