应用程序在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]
在你的特殊情况下 千分尺-注册-普罗米修斯(prometheus) 必须与弹簧套的千分表芯版本一致。它是 1.5.1
因为Spring Boot (Actuator)在2.3.0版本时就把这个依赖关系拉进来了。
implementation group: 'io.micrometer', name: 'micrometer-registry-prometheus', version: '1.5.1'
当查看你所包含的部分日志文件时,在我看来,多个依赖关系并没有全部存在或正确工作。请参阅Spring Boot关于使用依赖管理器的建议。https:/docs.spring.iospring-bootdocscurrentreferencehtmlusing-spring-boot.html#using-boot-build-systems。
当升级时,检查不同版本之间的releasenoteschangelog总是很有用的。
2.3版本的发布说明。https:/github.comspring-projectsspring-bootwikiSpring-Boot-2.3-发行说明。
2.2.7到2.3.0的变更日志见。https:/github.comspring-projectsspring-bootwikiSpring-Boot-2.3.0-Configuration-Changelog。
如果您需要更多帮助,请提供有关您的配置信息。