Remove handling of spring.git.properties

Closes gh-10857
pull/10871/head
Stephane Nicoll 7 years ago
parent 8fe49eb9f7
commit 74677629ff

@ -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",

@ -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");

@ -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;

@ -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",

@ -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");

Loading…
Cancel
Save