简述
spring boot 的出现最主要的原因之一就是解决spring的依赖管理,减少各种依赖包的冲突,让开发者重点关注开发本身,减少环境的配置。
在Spring Boot 没有出现之前,SSH框架整合,最开始的问题就是版本冲突,各种版本之间不兼容,让开发者苦不堪言,很长时间才能搭建出完整的一套框架。
为了解决该问题,Spring Boot 应运而生,当然Spring Boot 对大部分的第三方依赖都进行了完整的测试。
不过最近发现,Spring Boot 升级太快,项目的升级速度已经无法跟上了。
为了尽量保持与最新版本相差不太远,今天使用了下最新的2.4.0 项目中的各种依赖,直接瘫痪,无奈之下,切换至2.3.6.
切换至2.3.6,发现Spring kafka 整合出现异常。异常信息如下
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kafkaListenerContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/kafka/KafkaAnnotationDrivenConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory]: Factory method 'kafkaListenerContainerFactory' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kafkaConsumerFactory' defined in class path resource [org/springframework/boot/autoconfigure/kafka/KafkaAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.kafka.core.ConsumerFactory]: Factory method 'kafkaConsumerFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/kafka/core/MicrometerConsumerListener
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:655)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:635)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowire