How to specify classpath for two identical dependencies in spring application yml?

I'm trying to create a kafka consumer bean via application.yml, but I get built exception:

Correct the classpath of your application so that it contains a single, compatible version of org.apache.kafka.clients.consumer.Consumer

The main problem is that I have two different versions of kafka-client: 1.1.1 and 2.1.1. How can I specify classpath for a specific version from the external library?

primary-cluster:
    consumer:
      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
      value-deserializer: org.apache.kafka.common.serialization.StringDeserializer

Ответы (0 шт):