Commit 1830dcf1 authored by Stephane Nicoll's avatar Stephane Nicoll

Rename AutoConfigurationReportEndpoint to ConditionsEndpoint

This commit further aligns the change to ConditionEvaluationReport by
renaming the 'autoconfig' endpoint to 'conditions'.

Closes gh-2945
parent 16133614
......@@ -47,12 +47,12 @@ import org.springframework.util.StringUtils;
* @author Andy Wilkinson
* @since 2.0.0
*/
@Endpoint(id = "autoconfig")
public class AutoConfigurationReportEndpoint {
@Endpoint(id = "conditions")
public class ConditionsReportEndpoint {
private final ConditionEvaluationReport conditionEvaluationReport;
public AutoConfigurationReportEndpoint(
public ConditionsReportEndpoint(
ConditionEvaluationReport conditionEvaluationReport) {
this.conditionEvaluationReport = conditionEvaluationReport;
}
......
......@@ -27,17 +27,17 @@ import org.springframework.context.annotation.Configuration;
/**
* {@link EnableAutoConfiguration Auto-configuration} for the
* {@link AutoConfigurationReportEndpoint}.
* {@link ConditionsReportEndpoint}.
*
* @author Phillip Webb
* @since 2.0.0
*/
@Configuration
public class AutoConfigurationReportEndpointAutoConfiguration {
public class ConditionsReportEndpointAutoConfiguration {
private ConfigurableApplicationContext context;
public AutoConfigurationReportEndpointAutoConfiguration(
public ConditionsReportEndpointAutoConfiguration(
ConfigurableApplicationContext context) {
this.context = context;
}
......@@ -45,8 +45,8 @@ public class AutoConfigurationReportEndpointAutoConfiguration {
@Bean
@ConditionalOnMissingBean(search = SearchStrategy.CURRENT)
@ConditionalOnEnabledEndpoint
public AutoConfigurationReportEndpoint autoConfigurationReportEndpoint() {
return new AutoConfigurationReportEndpoint(
public ConditionsReportEndpoint conditionsReportEndpoint() {
return new ConditionsReportEndpoint(
ConditionEvaluationReport.get(this.context.getBeanFactory()));
}
......
......@@ -6,7 +6,7 @@ org.springframework.boot.actuate.autoconfigure.beans.BeansEndpointAutoConfigurat
org.springframework.boot.actuate.autoconfigure.cassandra.CassandraHealthIndicatorAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.cloudfoundry.servlet.CloudFoundryActuatorAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.cloudfoundry.reactive.ReactiveCloudFoundryActuatorAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.condition.AutoConfigurationReportEndpointAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.condition.ConditionsReportEndpointAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.context.properties.ConfigurationPropertiesReportEndpointAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.context.ShutdownEndpointAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.couchbase.CouchbaseHealthIndicatorAutoConfiguration,\
......
......@@ -24,28 +24,28 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link AutoConfigurationReportEndpointAutoConfiguration}.
* Tests for {@link ConditionsReportEndpointAutoConfiguration}.
*
* @author Phillip Webb
*/
public class AutoConfigurationReportEndpointAutoConfigurationTests {
public class ConditionsReportEndpointAutoConfigurationTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations
.of(AutoConfigurationReportEndpointAutoConfiguration.class));
.of(ConditionsReportEndpointAutoConfiguration.class));
@Test
public void runShouldHaveEndpointBean() {
this.contextRunner.run((context) -> assertThat(context)
.hasSingleBean(AutoConfigurationReportEndpoint.class));
.hasSingleBean(ConditionsReportEndpoint.class));
}
@Test
public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean()
throws Exception {
this.contextRunner.withPropertyValues("endpoints.autoconfig.enabled:false")
this.contextRunner.withPropertyValues("endpoints.conditions.enabled:false")
.run((context) -> assertThat(context)
.doesNotHaveBean(AutoConfigurationReportEndpoint.class));
.doesNotHaveBean(ConditionsReportEndpoint.class));
}
}
......@@ -23,7 +23,7 @@ import javax.annotation.PostConstruct;
import org.junit.Test;
import org.springframework.boot.actuate.autoconfigure.condition.AutoConfigurationReportEndpoint.Report;
import org.springframework.boot.actuate.autoconfigure.condition.ConditionsReportEndpoint.Report;
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
......@@ -37,19 +37,19 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
/**
* Tests for {@link AutoConfigurationReportEndpoint}.
* Tests for {@link ConditionsReportEndpoint}.
*
* @author Greg Turnquist
* @author Phillip Webb
* @author Andy Wilkinson
*/
public class AutoConfigurationReportEndpointTests {
public class ConditionsReportEndpointTests {
@Test
public void invoke() throws Exception {
new ApplicationContextRunner().withUserConfiguration(Config.class)
.run((context) -> {
Report report = context.getBean(AutoConfigurationReportEndpoint.class)
Report report = context.getBean(ConditionsReportEndpoint.class)
.getEvaluationReport();
assertThat(report.getPositiveMatches()).isEmpty();
assertThat(report.getNegativeMatches()).containsKey("a");
......@@ -79,9 +79,9 @@ public class AutoConfigurationReportEndpointTests {
}
@Bean
public AutoConfigurationReportEndpoint endpoint(
public ConditionsReportEndpoint endpoint(
ConditionEvaluationReport report) {
return new AutoConfigurationReportEndpoint(report);
return new ConditionsReportEndpoint(report);
}
}
......
......@@ -21,7 +21,7 @@ import java.util.List;
import org.springframework.boot.actuate.autoconfigure.audit.AuditEventsEndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.beans.BeansEndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.condition.AutoConfigurationReportEndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.condition.ConditionsReportEndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.context.ShutdownEndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.context.properties.ConfigurationPropertiesReportEndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.env.EnvironmentEndpointAutoConfiguration;
......@@ -42,7 +42,7 @@ final class EndpointAutoConfigurationClasses {
List<Class<?>> all = new ArrayList<>();
all.add(AuditEventsEndpointAutoConfiguration.class);
all.add(BeansEndpointAutoConfiguration.class);
all.add(AutoConfigurationReportEndpointAutoConfiguration.class);
all.add(ConditionsReportEndpointAutoConfiguration.class);
all.add(ConfigurationPropertiesReportEndpointAutoConfiguration.class);
all.add(ShutdownEndpointAutoConfiguration.class);
all.add(EnvironmentEndpointAutoConfiguration.class);
......
......@@ -54,7 +54,7 @@ public class JmxEndpointIntegrationTests {
this.contextRunner.run((context) -> {
MBeanServer mBeanServer = context.getBean(MBeanServer.class);
checkEndpointMBeans(mBeanServer,
new String[] { "autoconfig", "beans", "configprops", "env", "health",
new String[] { "beans", "conditions", "configprops", "env", "health",
"info", "mappings", "status", "threaddump", "trace" },
new String[] { "shutdown" });
});
......@@ -66,7 +66,7 @@ public class JmxEndpointIntegrationTests {
.run((context) -> {
MBeanServer mBeanServer = context.getBean(MBeanServer.class);
checkEndpointMBeans(mBeanServer, new String[0],
new String[] { "autoconfig", "beans", "configprops", "env",
new String[] { "beans", "conditions", "configprops", "env",
"health", "mappings", "shutdown", "threaddump",
"trace" });
......@@ -79,7 +79,7 @@ public class JmxEndpointIntegrationTests {
"endpoints.beans.jmx.enabled=true").run((context) -> {
MBeanServer mBeanServer = context.getBean(MBeanServer.class);
checkEndpointMBeans(mBeanServer, new String[] { "beans" },
new String[] { "autoconfig", "configprops", "env", "health",
new String[] { "conditions", "configprops", "env", "health",
"mappings", "shutdown", "threaddump", "trace" });
});
}
......
......@@ -64,8 +64,8 @@ public class WebMvcEndpointExposureIntegrationTests {
public void webEndpointsAreDisabledByDefault() {
this.contextRunner.run((context) -> {
MockMvc mvc = MockMvcBuilders.webAppContextSetup(context).build();
assertThat(isExposed(mvc, HttpMethod.GET, "autoconfig")).isFalse();
assertThat(isExposed(mvc, HttpMethod.GET, "beans")).isFalse();
assertThat(isExposed(mvc, HttpMethod.GET, "conditions")).isFalse();
assertThat(isExposed(mvc, HttpMethod.GET, "configprops")).isFalse();
assertThat(isExposed(mvc, HttpMethod.GET, "env")).isFalse();
assertThat(isExposed(mvc, HttpMethod.GET, "health")).isFalse();
......@@ -84,8 +84,8 @@ public class WebMvcEndpointExposureIntegrationTests {
.withPropertyValues("endpoints.default.web.enabled=true");
contextRunner.run((context) -> {
MockMvc mvc = MockMvcBuilders.webAppContextSetup(context).build();
assertThat(isExposed(mvc, HttpMethod.GET, "autoconfig")).isTrue();
assertThat(isExposed(mvc, HttpMethod.GET, "beans")).isTrue();
assertThat(isExposed(mvc, HttpMethod.GET, "conditions")).isTrue();
assertThat(isExposed(mvc, HttpMethod.GET, "configprops")).isTrue();
assertThat(isExposed(mvc, HttpMethod.GET, "env")).isTrue();
assertThat(isExposed(mvc, HttpMethod.GET, "health")).isTrue();
......
......@@ -89,7 +89,7 @@ public class ConditionEvaluationReportLoggingListener
public void logAutoConfigurationReport(boolean isCrashReport) {
if (this.report == null) {
if (this.applicationContext == null) {
this.logger.info("Unable to provide auto-configuration report "
this.logger.info("Unable to provide the conditions report "
+ "due to missing ApplicationContext");
return;
}
......@@ -101,7 +101,7 @@ public class ConditionEvaluationReportLoggingListener
&& !this.logger.isDebugEnabled()) {
this.logger.info(String
.format("%n%nError starting ApplicationContext. To display the "
+ "auto-configuration report re-run your application with "
+ "conditions report re-run your application with "
+ "'debug' enabled."));
}
if (this.logger.isDebugEnabled()) {
......
......@@ -47,7 +47,7 @@ public class ConditionEvaluationReportMessage {
StringBuilder message = new StringBuilder();
message.append(String.format("%n%n%n"));
message.append(String.format("=========================%n"));
message.append(String.format("AUTO-CONFIGURATION REPORT%n"));
message.append(String.format("CONDITIONS REPORT%n"));
message.append(String.format("=========================%n%n%n"));
message.append(String.format("Positive matches:%n"));
message.append(String.format("-----------------%n"));
......
......@@ -64,7 +64,7 @@ public class ConditionEvaluationReportLoggingListenerTests {
context.refresh();
withDebugLogging(() -> this.initializer
.onApplicationEvent(new ContextRefreshedEvent(context)));
assertThat(this.outputCapture.toString()).contains("AUTO-CONFIGURATION REPORT");
assertThat(this.outputCapture.toString()).contains("CONDITIONS REPORT");
}
@Test
......@@ -81,7 +81,7 @@ public class ConditionEvaluationReportLoggingListenerTests {
() -> this.initializer.onApplicationEvent(new ApplicationFailedEvent(
new SpringApplication(), new String[0], context, ex)));
}
assertThat(this.outputCapture.toString()).contains("AUTO-CONFIGURATION REPORT");
assertThat(this.outputCapture.toString()).contains("CONDITIONS REPORT");
}
@Test
......@@ -98,7 +98,7 @@ public class ConditionEvaluationReportLoggingListenerTests {
new SpringApplication(), new String[0], context, ex));
}
assertThat(this.outputCapture.toString()).contains("Error starting"
+ " ApplicationContext. To display the auto-configuration report re-run"
+ " ApplicationContext. To display the conditions report re-run"
+ " your application with 'debug' enabled.");
}
......@@ -141,7 +141,7 @@ public class ConditionEvaluationReportLoggingListenerTests {
.onApplicationEvent(new ApplicationFailedEvent(new SpringApplication(),
new String[0], null, new RuntimeException("Planned")));
assertThat(this.outputCapture.toString())
.contains("Unable to provide auto-configuration report");
.contains("Unable to provide the conditions report");
}
private void withDebugLogging(Runnable runnable) {
......
......@@ -1077,13 +1077,6 @@ content into your application; rather pick only the properties that you need.
endpoints.auditevents.web.enabled= # Expose the auditevents endpoint as a Web endpoint.
endpoints.auditevents.web.path=auditevents # Path of the auditevents endpoint.
# AUTO-CONFIGURATION REPORT ENDPOINT ({sc-spring-boot-actuator-autoconfigure}/condition/AutoConfigurationReportEndpoint.{sc-ext}[AutoConfigurationReportEndpoint])
endpoints.autoconfig.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
endpoints.autoconfig.enabled= # Enable the autoconfig endpoint.
endpoints.autoconfig.jmx.enabled= # Expose the autoconfig endpoint as a JMX MBean.
endpoints.autoconfig.web.enabled= # Expose the autoconfig endpoint as a Web endpoint.
endpoints.autoconfig.web.path=autoconfig # Path of the autoconfig endpoint.
# BEANS ENDPOINT ({sc-spring-boot-actuator}/beans/BeansEndpoint.{sc-ext}[BeansEndpoint])
endpoints.beans.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
endpoints.beans.enabled= # Enable the beans endpoint.
......@@ -1091,6 +1084,13 @@ content into your application; rather pick only the properties that you need.
endpoints.beans.web.enabled= # Expose the beans endpoint as a Web endpoint.
endpoints.beans.web.path=beans # Path of the beans endpoint.
# CONDITIONS REPORT ENDPOINT ({sc-spring-boot-actuator-autoconfigure}/condition/ConditionsReportEndpoint.{sc-ext}[ConditionsReportEndpoint])
endpoints.conditions.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
endpoints.conditions.enabled= # Enable the conditions endpoint.
endpoints.conditions.jmx.enabled= # Expose the conditions endpoint as a JMX MBean.
endpoints.conditions.web.enabled= # Expose the conditions endpoint as a Web endpoint.
endpoints.conditions.web.path=conditions # Path of the conditions endpoint.
# CONFIGURATION PROPERTIES REPORT ENDPOINT ({sc-spring-boot-actuator}/context/properties/ConfigurationPropertiesReportEndpoint.{sc-ext}[ConfigurationPropertiesReportEndpoint])
endpoints.configprops.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
endpoints.configprops.enabled= # Enable the configprops endpoint.
......
......@@ -2,10 +2,10 @@
[[auto-configuration-classes]]
== Auto-configuration classes
Here is a list of all auto-configuration classes provided by Spring Boot, with links to
documentation and source code. Remember to also look at the autoconfig report in your
documentation and source code. Remember to also look at the conditions report in your
application for more details of which features are switched on.
(To do so, start the app with `--debug` or `-Ddebug` or, in an Actuator application, use
the `autoconfig` endpoint).
the `conditions` endpoint).
......
......@@ -54,7 +54,7 @@ sometimes things fail, and it can be hard to tell why.
There is a really useful `ConditionEvaluationReport` available in any Spring Boot
`ApplicationContext`. You can see it if you enable `DEBUG` logging output. If you use
the `spring-boot-actuator`, there is also an `autoconfig` endpoint that renders the report
the `spring-boot-actuator`, there is also a `conditions` endpoint that renders the report
in JSON. Use that endpoint to debug the application and see what features have been added (and
which not) by Spring Boot at runtime.
......@@ -65,7 +65,7 @@ reading the code, remember the following rules of thumb:
`+@Conditional*+` annotations to find out what features they enable and when. Add
`--debug` to the command line or a System property `-Ddebug` to get a log on the
console of all the auto-configuration decisions that were made in your app. In a running
Actuator app, look at the `autoconfig` endpoint (`/application/autoconfig` or the JMX
Actuator app, look at the `conditions` endpoint (`/application/conditions` or the JMX
equivalent) for the same information.
* Look for classes that are `@ConfigurationProperties` (such as
{sc-spring-boot-autoconfigure}/web/ServerProperties.{sc-ext}[`ServerProperties`])
......
......@@ -71,9 +71,9 @@ The following technology-agnostic endpoints are available:
|`auditevents`
|Exposes audit events information for the current application.
|`autoconfig`
|Displays an auto-configuration report showing all auto-configuration candidates and the
reason why they '`were`' or '`were not`' applied.
|`conditions`
|Showing the conditions that were evaluated on configuration and auto-configuration
classes and the reasons why they did or did not match.
|`beans`
|Displays a complete list of all the Spring beans in your application.
......
......@@ -3319,7 +3319,8 @@ The line in the preceding example passes a value of `true` for the
By default, the DDL execution (or validation) is deferred until the `ApplicationContext`
has started. There is also a `spring.jpa.generate-ddl` flag, but it is not used if
Hibernate autoconfig is active, because the `ddl-auto` settings are more fine-grained.
Hibernate auto-configuration is active, because the `ddl-auto` settings are more
fine-grained.
......
......@@ -74,7 +74,7 @@ public class SpringBootDependencyInjectionTestExecutionListenerTests {
catch (IllegalStateException ex) {
// Expected
}
this.out.expect(containsString("AUTO-CONFIGURATION REPORT"));
this.out.expect(containsString("CONDITIONS REPORT"));
this.out.expect(containsString("Positive matches"));
this.out.expect(containsString("Negative matches"));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment