Auto-configure GitInfo

This commit moves `GitInfo` to a general "project info" area that will be
further improved with others project related information.

Deprecate `spring.git.properties` in favour of `spring.info.git.location`

Closes gh-2484
This commit is contained in:
Stephane Nicoll
2016-03-03 14:31:00 +01:00
parent 03ecdce4fb
commit 0f820afa86
10 changed files with 368 additions and 74 deletions

View File

@@ -40,6 +40,7 @@ import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.metrics.Metric;
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport;
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
import org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
import org.springframework.boot.test.EnvironmentTestUtils;
@@ -140,7 +141,7 @@ public class EndpointAutoConfigurationTests {
public void testInfoEndpointConfiguration() throws Exception {
this.context = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, "info.foo:bar");
this.context.register(EndpointAutoConfiguration.class);
this.context.register(ProjectInfoAutoConfiguration.class, EndpointAutoConfiguration.class);
this.context.refresh();
InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class);
assertThat(endpoint).isNotNull();
@@ -152,7 +153,7 @@ public class EndpointAutoConfigurationTests {
public void testNoGitProperties() throws Exception {
this.context = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context,
"spring.git.properties:classpath:nonexistent");
"spring.info.git.location:classpath:nonexistent");
this.context.register(EndpointAutoConfiguration.class);
this.context.refresh();
InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class);