首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >org.springframework.boot.actuate.autoconfigure.metrics.MetricsEndpointAutoConfiguration上的误差处理条件

org.springframework.boot.actuate.autoconfigure.metrics.MetricsEndpointAutoConfiguration上的误差处理条件
EN

Stack Overflow用户
提问于 2020-05-11 15:28:31
回答 1查看 7K关注 0票数 3

我是一个新手Java程序员。我正在将一些测试代码从一个旧的jHipster项目转移到一个新的项目中。我将其添加到pom.xml中以修复编译错误。这修复了我的编译问题,但导致运行时错误。

代码语言:javascript
复制
<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

代码语言:javascript
复制
 <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方法不覆盖或实现超类型的方法

有人知道怎么修吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-05-11 15:54:27

这种依赖性似乎存在一个问题。首先,不要指定版本,除非您非常肯定不会出现任何依赖冲突。这是spring-boot如此流行的原因之一,您不必担心依赖关系及其兼容性。让spring-boot来处理。兼容版本将从父版本继承。

另一个问题是,为什么要使用spring-boot-actuator?您应该使用spring-boot-starter-actuator

这是一个样本

代码语言:javascript
复制
<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

代码语言:javascript
复制
<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>

希望这能有所帮助

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61733373

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档