Auto-configure endpoints in main context so they are always discovered

Closes gh-11046
pull/11066/head
Andy Wilkinson 7 years ago
parent b9c104a22d
commit 3e46b5c5c7

@ -16,8 +16,8 @@
package org.springframework.boot.actuate.autoconfigure.logging;
import org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration;
import org.springframework.boot.actuate.logging.LogFileWebEndpoint;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@ -26,24 +26,24 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.util.StringUtils;
/**
* {@link ManagementContextConfiguration} for {@link LogFileWebEndpoint}.
* {@link EnableAutoConfiguration Auto-configuration} for {@link LogFileWebEndpoint}.
*
* @author Andy Wilkinson
* @since 2.0.0
*/
@ManagementContextConfiguration
@Configuration
@EnableConfigurationProperties(LogFileWebEndpointProperties.class)
public class LogFileWebEndpointManagementContextConfiguration {
public class LogFileWebEndpointAutoConfiguration {
private final LogFileWebEndpointProperties properties;
public LogFileWebEndpointManagementContextConfiguration(
LogFileWebEndpointProperties properties) {
public LogFileWebEndpointAutoConfiguration(LogFileWebEndpointProperties properties) {
this.properties = properties;
}

@ -17,19 +17,20 @@
package org.springframework.boot.actuate.autoconfigure.management;
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnEnabledEndpoint;
import org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration;
import org.springframework.boot.actuate.management.HeapDumpWebEndpoint;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* {@link ManagementContextConfiguration} for {@link HeapDumpWebEndpoint}.
* {@link EnableAutoConfiguration Auto-configuration} for {@link HeapDumpWebEndpoint}.
*
* @author Andy Wilkinson
* @since 2.0.0
*/
@ManagementContextConfiguration
public class HeapDumpWebEndpointManagementContextConfiguration {
@Configuration
public class HeapDumpWebEndpointAutoConfiguration {
@Bean
@ConditionalOnMissingBean

@ -24,8 +24,10 @@ org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthIndicatorAut
org.springframework.boot.actuate.autoconfigure.jms.JmsHealthIndicatorAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.ldap.LdapHealthIndicatorAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.liquibase.LiquibaseEndpointAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.logging.LogFileWebEndpointAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.logging.LoggersEndpointAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.mail.MailHealthIndicatorAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.management.HeapDumpWebEndpointAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.management.ThreadDumpEndpointAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.mongo.MongoHealthIndicatorAutoConfiguration,\
@ -49,8 +51,6 @@ org.springframework.boot.actuate.autoconfigure.endpoint.web.servlet.WebMvcEndpoi
org.springframework.boot.actuate.autoconfigure.endpoint.web.jersey.JerseyWebEndpointManagementContextConfiguration,\
org.springframework.boot.actuate.autoconfigure.health.HealthWebEndpointManagementContextConfiguration,\
org.springframework.boot.actuate.autoconfigure.jolokia.JolokiaManagementContextConfiguration,\
org.springframework.boot.actuate.autoconfigure.logging.LogFileWebEndpointManagementContextConfiguration,\
org.springframework.boot.actuate.autoconfigure.management.HeapDumpWebEndpointManagementContextConfiguration,\
org.springframework.boot.actuate.autoconfigure.web.jersey.JerseyManagementChildContextConfiguration,\
org.springframework.boot.actuate.autoconfigure.web.reactive.ReactiveManagementChildContextConfiguration,\
org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementChildContextConfiguration,\

@ -33,20 +33,20 @@ import org.springframework.util.StreamUtils;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link LogFileWebEndpointManagementContextConfiguration}.
* Tests for {@link LogFileWebEndpointAutoConfiguration}.
*
* @author Andy Wilkinson
* @author Stephane Nicoll
* @author Phillip Webb
*/
public class LogFileWebEndpointManagementContextConfigurationTests {
public class LogFileWebEndpointAutoConfigurationTests {
@Rule
public TemporaryFolder temp = new TemporaryFolder();
private WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
.withUserConfiguration(
LogFileWebEndpointManagementContextConfiguration.class);
LogFileWebEndpointAutoConfiguration.class);
@Test
public void logFileWebEndpointIsAutoConfiguredWhenLoggingFileIsSet() {

@ -24,16 +24,16 @@ import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link HeapDumpWebEndpointManagementContextConfiguration}.
* Tests for {@link HeapDumpWebEndpointAutoConfiguration}.
*
* @author Phillip Webb
*/
public class HeapDumpWebEndpointManagementContextConfigurationTests {
public class HeapDumpWebEndpointAutoConfigurationTests {
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
.withPropertyValues("management.endpoints.web.expose:*")
.withUserConfiguration(
HeapDumpWebEndpointManagementContextConfiguration.class);
HeapDumpWebEndpointAutoConfiguration.class);
@Test
public void runShouldCreateIndicator() throws Exception {
Loading…
Cancel
Save