gpt4 book ai didi

Spring Boot 2.0 Actuator git 属性未添加到/info

转载 作者:行者123 更新时间:2023-12-02 05:19:03 29 4
gpt4 key购买 nike

我将 GradleSpring Boot 2.0.0.M7 结合使用,并应用了以下插件:

buildscript {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M7"
}
}

plugins {
id "com.gorylenko.gradle-git-properties" version "1.4.17"
}

spring-boot-starter-actuator 依赖项也在那里。 git.properties 文件已正确生成到 build/main/resoures 目录。我还添加了属性 management.info.git.mode=full。根据官方文档,git information should be added使用 GitInfoContributor 自动到 /info 端点。但是,上述方法均无济于事,/info 端点返回空 JSON - {}。关于如何解决这个问题有什么想法吗?

更新 1:到目前为止我发现的是,如果我手动将 git.properties 复制到 out/resources ,这样它就可以工作,但由于某种原因它们没有放在那里。

更新2:当我使用 gradle bootRun 运行时,它可以工作,但是当我从 Intellij IDEA 启动它时,我们运行 gradle clean build 运行测试,检查这些属性是否显示在 /info 端点 - 它不起作用。

最佳答案

问题是从 IDE 运行应用程序。由于这些属性是在 JAR 组装阶段生成的,因此不包括在内。通过 java -jar artifact.jargradle bootRun 运行应用程序不会出现任何问题。

感谢@fateddy 帮助解决问题。

关于Spring Boot 2.0 Actuator git 属性未添加到/info,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48133150/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com