我正在尝试使用SpringBoot(1.5.9)和Spring-kafka(2.1.0)来设置Kafka Consumer.但是,当我启动我的应用程序时,我在Kafka MessagingMessageListenerAdapter上获得了java.lang.NoSuchMethodError:org.springframework.util.Assert.state(ZLjava/util/function/Supplier;)V.我尝试使用Spring-Kafka(1.2.0)并且错误消失了.有没有其他人遇到这个版本不兼容?
这是我的配置类
@EnableKafka
@Configuration
public class ImporterConfigs{
static Logger logger = Logger.getLogger(ImporterConfigs.class);
@Value("${kafka.bootstrap-servers}")
private static String bootstrapServers;
@Bean
public Map<String, Object> consumerKafkaConfigs() {
Map<String, Object> props = new HashMap<>();
// list of host:port pairs used for establishing the initial connections to the Kakfa cluster
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
// allows a pool of processes to divide the work of consuming and processing records
props.put(ConsumerConfig.GROUP_ID_CONFIG, "test-consumer-group");
return props;
}
@Bean
public ConsumerFactory<String, String> consumerFactory() {
return new …Run Code Online (Sandbox Code Playgroud) spring-kafka ×1