Merge pull request #18571 from dreis2211

* gh-18571:
  Polish "Correct Mono import in LegacyHealthEndpointCompatibilityConfiguration"
  Correct Mono import in LegacyHealthEndpointCompatibilityConfiguration

Closes gh-18571
This commit is contained in:
Andy Wilkinson 2019-10-14 09:35:52 +01:00
commit 1a7a3118d7
3 changed files with 15 additions and 2 deletions

View File

@ -16,7 +16,7 @@
package org.springframework.boot.actuate.autoconfigure.health;
import io.micrometer.shaded.reactor.core.publisher.Mono;
import reactor.core.publisher.Mono;
import org.springframework.boot.actuate.health.HealthAggregator;
import org.springframework.boot.actuate.health.HealthContributorRegistry;

View File

@ -44,9 +44,11 @@ import org.springframework.boot.actuate.health.NamedContributor;
import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry;
import org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension;
import org.springframework.boot.actuate.health.ReactiveHealthIndicator;
import org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry;
import org.springframework.boot.actuate.health.Status;
import org.springframework.boot.actuate.health.StatusAggregator;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.test.context.FilteredClassLoader;
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
import org.springframework.context.annotation.Bean;
@ -293,6 +295,17 @@ class HealthEndpointAutoConfigurationTests {
});
}
@Test
void runWhenReactorAvailableCreatesReactiveHealthIndicatorRegistryBean() {
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(ReactiveHealthIndicatorRegistry.class));
}
@Test // gh-18570
void runWhenReactorUnavailableDoesNotCreateReactiveHealthIndicatorRegistryBean() {
this.contextRunner.withClassLoader(new FilteredClassLoader(Mono.class.getPackage().getName()))
.run((context) -> assertThat(context).doesNotHaveBean(ReactiveHealthIndicatorRegistry.class));
}
@Configuration(proxyBeanMethods = false)
static class HealthIndicatorsConfiguration {

View File

@ -13,7 +13,7 @@
name="com.puppycrawl.tools.checkstyle.checks.imports.IllegalImportCheck">
<property name="regexp" value="true" />
<property name="illegalPkgs"
value="^sun.*, ^org\.apache\.commons\.(?!compress|dbcp2|lang|lang3|logging|pool2).*, ^com\.google\.common.*, ^org\.flywaydb\.core\.internal.*, ^org\.testcontainers\.shaded.*" />
value="^sun.*, ^org\.apache\.commons\.(?!compress|dbcp2|lang|lang3|logging|pool2).*, ^com\.google\.common.*, ^io\.micrometer\.shaded.*, ^org\.flywaydb\.core\.internal.*, ^org\.testcontainers\.shaded.*" />
<property name="illegalClasses"
value="^com\.hazelcast\.util\.Base64, ^org\.junit\.rules\.ExpectedException, ^org\.mockito\.InjectMocks, ^org\.slf4j\.LoggerFactory, ^reactor\.core\.support\.Assert" />
</module>