【问题标题】:Spring Boot Info end pointSpring Boot 信息端点
【发布时间】:2015-01-31 11:09:26
【问题描述】:

我们有 application.yml 包含以下信息

info:
   build:
      artifact: ${project.artifactId}
      name: ${project.name}
      description: ${project.description}
      version: ${project.version}

当我们通过 mvn spring-boot:run 访问 /info 端点时,我们看到以下内容

"build": {
    "artifact": "${project.artifactId}",
    "version": "${project.version}",
    "name": "${project.name}",
    "description": "${project.description}"
},

这些值不会被替换。

已开启过滤的标准 Spring Boot Maven POM

<resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>

默认情况下过滤是否适用于 YML 文件?

【问题讨论】:

  • 什么版本的 Spring Boot?您是否使用 spring-boot-starter-parent 作为父 pom?

标签: spring maven spring-boot


【解决方案1】:

我无法复制它,我使用了相同的配置并且它正在填充该值。正如 Dave Syer 所提到的,我确实在我的父母 pom 中具有以下价值

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.2.3.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

【讨论】:

    猜你喜欢
    • 2018-04-10
    • 2019-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-03
    • 2016-12-20
    相关资源
    最近更新 更多