Merge branch '2.3.x'

Closes gh-22698
pull/22699/head
Brian Clozel 4 years ago
commit 6efff7b585

@ -40,14 +40,14 @@ import org.springframework.context.annotation.Configuration;
public class AvailabilityHealthContributorAutoConfiguration { public class AvailabilityHealthContributorAutoConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean(name = "livenessStateHealthIndicator")
@ConditionalOnProperty(prefix = "management.health.livenessstate", name = "enabled", havingValue = "true") @ConditionalOnProperty(prefix = "management.health.livenessstate", name = "enabled", havingValue = "true")
public LivenessStateHealthIndicator livenessStateHealthIndicator(ApplicationAvailability applicationAvailability) { public LivenessStateHealthIndicator livenessStateHealthIndicator(ApplicationAvailability applicationAvailability) {
return new LivenessStateHealthIndicator(applicationAvailability); return new LivenessStateHealthIndicator(applicationAvailability);
} }
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean(name = "readinessStateHealthIndicator")
@ConditionalOnProperty(prefix = "management.health.readinessstate", name = "enabled", havingValue = "true") @ConditionalOnProperty(prefix = "management.health.readinessstate", name = "enabled", havingValue = "true")
public ReadinessStateHealthIndicator readinessStateHealthIndicator( public ReadinessStateHealthIndicator readinessStateHealthIndicator(
ApplicationAvailability applicationAvailability) { ApplicationAvailability applicationAvailability) {

@ -48,14 +48,15 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
public class AvailabilityProbesAutoConfiguration { public class AvailabilityProbesAutoConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean(name = "livenessStateHealthIndicator")
public LivenessStateHealthIndicator livenessStateProbeIndicator(ApplicationAvailability applicationAvailability) { public LivenessStateHealthIndicator livenessStateHealthIndicator(ApplicationAvailability applicationAvailability) {
return new LivenessStateHealthIndicator(applicationAvailability); return new LivenessStateHealthIndicator(applicationAvailability);
} }
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean(name = "readinessStateHealthIndicator")
public ReadinessStateHealthIndicator readinessStateProbeIndicator(ApplicationAvailability applicationAvailability) { public ReadinessStateHealthIndicator readinessStateHealthIndicator(
ApplicationAvailability applicationAvailability) {
return new ReadinessStateHealthIndicator(applicationAvailability); return new ReadinessStateHealthIndicator(applicationAvailability);
} }

@ -50,8 +50,8 @@ class AvailabilityProbesAutoConfigurationTests {
void probesWhenKubernetesAddsBeans() { void probesWhenKubernetesAddsBeans() {
this.contextRunner.withPropertyValues("spring.main.cloud-platform=kubernetes") this.contextRunner.withPropertyValues("spring.main.cloud-platform=kubernetes")
.run((context) -> assertThat(context).hasSingleBean(ApplicationAvailability.class) .run((context) -> assertThat(context).hasSingleBean(ApplicationAvailability.class)
.hasSingleBean(LivenessStateHealthIndicator.class) .hasSingleBean(LivenessStateHealthIndicator.class).hasBean("livenessStateHealthIndicator")
.hasSingleBean(ReadinessStateHealthIndicator.class) .hasSingleBean(ReadinessStateHealthIndicator.class).hasBean("readinessStateHealthIndicator")
.hasSingleBean(AvailabilityProbesHealthEndpointGroupsPostProcessor.class)); .hasSingleBean(AvailabilityProbesHealthEndpointGroupsPostProcessor.class));
} }
@ -59,8 +59,8 @@ class AvailabilityProbesAutoConfigurationTests {
void probesWhenPropertyEnabledAddsBeans() { void probesWhenPropertyEnabledAddsBeans() {
this.contextRunner.withPropertyValues("management.endpoint.health.probes.enabled=true") this.contextRunner.withPropertyValues("management.endpoint.health.probes.enabled=true")
.run((context) -> assertThat(context).hasSingleBean(ApplicationAvailability.class) .run((context) -> assertThat(context).hasSingleBean(ApplicationAvailability.class)
.hasSingleBean(LivenessStateHealthIndicator.class) .hasSingleBean(LivenessStateHealthIndicator.class).hasBean("livenessStateHealthIndicator")
.hasSingleBean(ReadinessStateHealthIndicator.class) .hasSingleBean(ReadinessStateHealthIndicator.class).hasBean("readinessStateHealthIndicator")
.hasSingleBean(AvailabilityProbesHealthEndpointGroupsPostProcessor.class)); .hasSingleBean(AvailabilityProbesHealthEndpointGroupsPostProcessor.class));
} }

Loading…
Cancel
Save