diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 6896fb974c..c1208981b4 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -190,14 +190,6 @@ "description": "Instrument all available data sources.", "defaultValue": true }, - { - "name": "spring.git.properties", - "type": "java.lang.String", - "description": "Resource reference to a generated git info properties file.", - "deprecation": { - "replacement": "spring.info.git.location" - } - }, { "name": "endpoints.actuator.enabled", "type": "java.lang.Boolean", diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfiguration.java index 17f9c28f3e..bd874bfbf8 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfiguration.java @@ -95,8 +95,7 @@ public class ProjectInfoAutoConfiguration { Environment environment = context.getEnvironment(); String location = environment.getProperty("spring.info.git.location"); if (location == null) { - location = environment.getProperty("spring.git.properties"); - location = (location != null ? location : "classpath:git.properties"); + location = "classpath:git.properties"; } ConditionMessage.Builder message = ConditionMessage .forCondition("GitResource"); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/info/ProjectInfoProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/info/ProjectInfoProperties.java index 37016c196f..beca19685a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/info/ProjectInfoProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/info/ProjectInfoProperties.java @@ -16,8 +16,6 @@ package org.springframework.boot.autoconfigure.info; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; @@ -43,16 +41,6 @@ public class ProjectInfoProperties { return this.git; } - /** - * Make sure that the "spring.git.properties" legacy key is used by default. - * @param defaultGitLocation the default git location to use - */ - @Autowired - void setDefaultGitLocation( - @Value("${spring.git.properties:classpath:git.properties}") Resource defaultGitLocation) { - getGit().setLocation(defaultGitLocation); - } - /** * Build specific info properties. */ @@ -82,7 +70,7 @@ public class ProjectInfoProperties { /** * Location of the generated git.properties file. */ - private Resource location; + private Resource location = new ClassPathResource("git.properties"); public Resource getLocation() { return this.location; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 5649e55fc1..a8d05d7f98 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -177,6 +177,14 @@ "http://localhost:9200" ] }, + { + "name": "spring.info.build.location", + "defaultValue": "classpath:META-INF/build-info.properties" + }, + { + "name": "spring.info.git.location", + "defaultValue": "classpath:git.properties" + }, { "name": "spring.freemarker.prefix", "defaultValue": "" @@ -1039,6 +1047,15 @@ "level": "error" } }, + { + "name": "spring.git.properties", + "type": "java.lang.String", + "description": "Resource reference to a generated git info properties file.", + "deprecation": { + "replacement": "spring.info.git.location", + "level": "error" + } + }, { "name": "spring.http.multipart.enabled", "type": "java.lang.Boolean", diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfigurationTests.java index a5b40be014..10e1406bec 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfigurationTests.java @@ -56,27 +56,6 @@ public class ProjectInfoAutoConfigurationTests { assertThat(beans).hasSize(0); } - @Test - public void gitLocationTakesPrecedenceOverLegacyKey() { - load("spring.info.git.location=classpath:/org/springframework/boot/autoconfigure/info/git.properties", - "spring.git.properties=classpath:/org/springframework/boot/autoconfigure/info/git-no-data.properties"); - GitProperties gitProperties = this.context.getBean(GitProperties.class); - assertThat(gitProperties.getBranch()).isNull(); - assertThat(gitProperties.getCommitId()) - .isEqualTo("f95038ec09e29d8f91982fd1cbcc0f3b131b1d0a"); - assertThat(gitProperties.getCommitTime().getTime()).isEqualTo(1456995720000L); - } - - @Test - public void gitLegacyKeyIsUsedAsFallback() { - load("spring.git.properties=classpath:/org/springframework/boot/autoconfigure/info/git-epoch.properties"); - GitProperties gitProperties = this.context.getBean(GitProperties.class); - assertThat(gitProperties.getBranch()).isEqualTo("master"); - assertThat(gitProperties.getCommitId()) - .isEqualTo("5009933788f5f8c687719de6a697074ff80b1b69"); - assertThat(gitProperties.getCommitTime().getTime()).isEqualTo(1457103850000L); - } - @Test public void gitPropertiesWithNoData() { load("spring.info.git.location=classpath:/org/springframework/boot/autoconfigure/info/git-no-data.properties");