我是一个新手Java程序员。我正在将一些测试代码从一个旧的jHipster项目转移到一个新的项目中。我将其添加到pom.xml中以修复编译错误。这修复了我的编译问题,但导致运行时错误。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
<version>1.5.7.RELEASE</version>
</dependency>我现在得到这些运行时错误。
由: org.springframework.boot.actuate.autoconfigure.metrics.MetricsEndpointAutoConfiguration引起的
:java.lang.IllegalStateException:错误处理条件导致的: java.lang.IllegalArgumentException:未能找到类java.lang.IllegalStateException
<spring-boot.version>2.2.5.RELEASE</spring-boot.version>如果我拆下弹簧启动执行器
org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter不兼容类型: java.time.Instant不能转换为java.util.Date不能访问,java.time.Instant方法不覆盖或实现超类型的方法
有人知道怎么修吗?
发布于 2020-05-11 15:54:27
这种依赖性似乎存在一个问题。首先,不要指定版本,除非您非常肯定不会出现任何依赖冲突。这是spring-boot如此流行的原因之一,您不必担心依赖关系及其兼容性。让spring-boot来处理。兼容版本将从父版本继承。
另一个问题是,为什么要使用spring-boot-actuator?您应该使用spring-boot-starter-actuator
这是一个样本
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>然后在dependencies
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<scope>provided</scope>
<!-- Spring will find the version compatible with the parent -->
</dependency>希望这能有所帮助
https://stackoverflow.com/questions/61733373
复制相似问题