报错信息:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-12-10 16:10:01.273 ERROR 20156 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : ***************************
APPLICATION FAILED TO START
***************************Description:An attempt was made to call the method org.springframework.core.annotation.AnnotationUtils.isCandidateClass(Ljava/lang/Class;Ljava/lang/Class;)Z but it does not exist. Its class, org.springframework.core.annotation.AnnotationUtils, is available from the following locations:jar:file:/D:/Lucifer/localRepository/org/springframework/spring-core/5.0.10.RELEASE/spring-core-5.0.10.RELEASE.jar!/org/springframework/core/annotation/AnnotationUtils.classIt was loaded from the following location:file:/D:/Lucifer/localRepository/org/springframework/spring-core/5.0.10.RELEASE/spring-core-5.0.10.RELEASE.jarAction:Correct the classpath of your application so that it contains a single, compatible version of org.springframework.core.annotation.AnnotationUtilsDisconnected from the target VM, address: '127.0.0.1:0', transport: 'socket'Process finished with exit code 1
查看pom.xml中的jar包版本:(我这里用的到是maven helper插件)
base-framework-mysql-support模块中,spring-core:4.3.23.RELEASE;
order-service模块中,spring-core-5.0.10.RELEASE;
order-service模块引入base-framework-mysql-support模块。因此在启动order-service模块时,提示以上错误。
原因:包的版本冲突了;
解决办法:
排除jar包;通过排查,发现mybatis-plus-boot-starter中包含spring-core:4.3.23.RELEASE,因此exclusion对jar包进行排除;
<exclusions><exclusion><artifactId>spring-beans</artifactId><groupId>org.springframework</groupId></exclusion></exclusions>
这里我排除base-framework-mysql-support模块中的低版本的spring-core:4.3.23.RELEASE;