我是靠谱客的博主 笑点低乌龟,最近开发中收集的这篇文章主要介绍actuator与spring-core依赖冲突问题,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2020-07-24 13:23:47.176 ERROR 10256 — [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :


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:

org.springframework.transaction.annotation.SpringTransactionAnnotationParser.isCandidateClass(SpringTransactionAnnotationParser.java:44)

The following method did not exist:

org.springframework.core.annotation.AnnotationUtils.isCandidateClass(Ljava/lang/Class;Ljava/lang/Class;)Z

The method’s class, org.springframework.core.annotation.AnnotationUtils, is available from the following locations:

jar:file:/D:/Maven/apache-maven-3.6.1/mvn/mvnrepository/org/springframework/spring-core/5.1.15.RELEASE/spring-core-5.1.15.RELEASE.jar!/org/springframework/core/annotation/AnnotationUtils.class

It was loaded from the following location:

file:/D:/Maven/apache-maven-3.6.1/mvn/mvnrepository/org/springframework/spring-core/5.1.15.RELEASE/spring-core-5.1.15.RELEASE.jar

Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.core.annotation.AnnotationUtils

================================================
加入了actuator依赖后报的错,是版本冲突

springcloud版本(G版,对应springboot版本为2.1.X,有严格的版本对应,所以需要注意)

<!--
springcloud依赖-->
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-dependencies -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Greenwich.SR3</version>
<type>pom</type>
<scope>import</scope>
</dependency>

springboot对应为2.1.14RELEASE版本(org.springframework.boot相关依赖都为2.1.14RELEASE)

<!--
springboot依赖-->
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.1.4.RELEASE</version>
<type>pom</type>
</dependency>

actuator依赖如下

<!--
actuator完善监控信息-->
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.1.14.RELEASE</version>
</dependency>

由于之前导入的某个依赖和actuator这两个依赖间有冲突,maven项目为了避免冲突一般都是将所有spring jar包版本封装进一个版本号中,这时候一个解决方法就是调整spring-core版本,就能解决冲突,我这边用的是5.2.7.RELEASE版本,提高了spring-core的版本,能够消除依赖冲突


<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.2.7.RELEASE</version>
</dependency>

应该还可以从另一个发生冲突的依赖处下手,但是还没找到解决办法所以就这样啦

最后

以上就是笑点低乌龟为你收集整理的actuator与spring-core依赖冲突问题的全部内容,希望文章能够帮你解决actuator与spring-core依赖冲突问题所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(60)

评论列表共有 0 条评论

立即
投稿
返回
顶部