Я пытаюсь использовать QueryDSL для разрешения предикатов Spring Data, а также документацию Swagger API для моей службы Spring Boot. Однако я столкнулся с проблемой. Когда мое приложение запускается, я получаю это сообщение об ошибке:
java.lang.NoSuchMethodError: 'com.google.common.collect.FluentIterable com.google.common.collect.FluentIterable.concat(java.lang.Iterable, java.lang.Iterable)
An attempt was made to call a method that does not exist. The attempt was made from the following location:
springfox.documentation.schema.DefaultModelDependencyProvider.dependentModels(DefaultModelDependencyProvider.java:79)
The following method did not exist:
'com.google.common.collect.FluentIterable com.google.common.collect.FluentIterable.concat(java.lang.Iterable, java.lang.Iterable)'
The method's class, com.google.common.collect.FluentIterable, is available from the following locations:
jar:file:/my_m2/com/google/guava/guava/18.0/guava-18.0.jar!/com/google/common/collect/FluentIterable.class
Action:
Correct the classpath of your application so that it contains a single, compatible version of com.google.common.collect.FluentIterable
Я обнаружил, что это происходит, потому что QueryDSL зависит от библиотеки Guava 18.0, но Springfox / Swagger зависит от библиотеки Guava 20.0, поэтому я в итоге обе версии библиотеки на моем classpath, и maven, кажется, отдает приоритет 18.0. Как я могу исправить это несоответствие зависимостей? Есть ли способ заставить QueryDSL попытаться использовать Guava 20.0 (в надежде, что он все еще будет функционировать)? Или, может быть, есть какой-то другой способ обойти это?
Версии: версия Spring Boot: 2.1.9.RELEASE
В этой версии Spring Boot используется версия QueryDSL: 4.2.1
версия Springfox Swagger: 2.9.2