问题遇到的现象和发生背景
分布式架构,编写了一个公共的SwaggerConfiguration配置类,在不抽取Feign接口的时候直接在本模块定义远程调用接口不会出现下面的报错,当通过抽取的API接口模块进行调用的时候运行项目就出现这样的情况
遇到的现象和发生背景,请写出第一个错误信息
用代码块功能插入代码,请勿粘贴截图。 不用代码块回答率下降 50%
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
com.zcl.dkbj.service.swagger.SwaggerConfiguration.groupRestApi(SwaggerConfiguration.java:40)
The following method did not exist:
springfox.documentation.builders.RequestHandlerSelectors.basePackage(Ljava/lang/String;)Ljava/util/function/Predicate;
The method's class, springfox.documentation.builders.RequestHandlerSelectors, is available from the following locations:
jar:file:/usr/local/apache-maven-3.8.6/Repository/io/springfox/springfox-core/2.7.0/springfox-core-2.7.0.jar!/springfox/documentation/builders/RequestHandlerSelectors.class
It was loaded from the following location:
file:/usr/local/apache-maven-3.8.6/Repository/io/springfox/springfox-core/2.7.0/springfox-core-2.7.0.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of springfox.documentation.builders.RequestHandlerSelectors
运行结果及详细报错内容
我的解答思路和尝试过的方法,不写自己思路的,回答率下降 60%
我的尝试解决方法就是在单独的模块中定义Feign的远程调用接口而不是抽取出独立的模块进行依赖注入调用,当时这样耦合度比较高