应用程序在2.2.6版本下工作正常,但当应用程序升级到spring boot 2.3.0的最新版本时,它停止工作并在启动期间失败。
2020-05-20T08:43:04.408+01:00 [APP/PROC/WEB/0] [OUT] 2020-05-20 07:43:04.407 ERROR 15 --- [ main] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'webMvcMetricsFilter' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/servlet/WebMvcMetricsAutoConfiguration.class]: Unsatisfied dependency expressed through method 'webMvcMetricsFilter' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'compositeMeterRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/CompositeMeterRegistryConfiguration.class]: Unsatisfied dependency expressed through method 'compositeMeterRegistry' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'prometheusMeterRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusMetricsExportAutoConfiguration.class]: Unsatisfied dependency expressed through method 'prometheusMeterRegistry' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'prometheusConfig' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusMetricsExportAutoConfiguration.class]: Unsatisfied dependency expressed through method 'prometheusConfig' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'management.metrics.export.prometheus-org.springframework.boot.actuate.autoconfigure.metrics.export.prometheus.PrometheusProperties': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.actuate.autoconfigure.metrics.export.prometheus.PrometheusProperties] from ClassLoader [org.springframework.boot.loader.LaunchedURLClassLoader@4f3f5b24]
可以在开始跟踪的底部看到下面的类未找到异常。

发布于 2020-05-24 21:45:12
在您的特殊情况下,micrometer-registry-prometheus必须与spring boot的微米内核版本保持一致。之所以称为1.5.1,是因为Spring Boot (Actuator)在2.3.0版本中引入了该依赖项。
implementation group: 'io.micrometer', name: 'micrometer-registry-prometheus', version: '1.5.1'发布于 2020-08-10 17:06:09
添加这个答案是因为我最初不理解
必须与spring boot的微米内核版本保持一致。
lestar cdog答案
micrometer registry prometheus软件包必须与io.microeter:micrometer core版本匹配。Io.microeter:微米-芯由弹簧执行器依赖性拉动。
您可以在IDE中检查io.microeter:micrometer core的版本
IntelliJ:项目窗口(cmd+ 1) ->外部库

发布于 2020-05-20 16:51:19
当查看您包含的部分日志文件时,在我看来,多个依赖项并不都在那里,也不能正常工作。请参阅Spring Boot关于使用依赖项管理器的建议:https://docs.spring.io/spring-boot/docs/current/reference/html/using-spring-boot.html#using-boot-build-systems
在升级时,检查版本之间的releasenotes/changelog总是有用的。
2.3的
如果您需要更多帮助,请提供有关配置的信息;
问题的原因
https://stackoverflow.com/questions/61908419
复制相似问题