Merge branch '2.3.x'
Closes gh-22744
This commit is contained in:
@@ -74,7 +74,7 @@ class DataSourceHealthContributorAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
void runWithRoutingAndEmbeddedDataSourceShouldIncludeRoutingDataSource() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class, RoutingDatasourceConfig.class)
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class, RoutingDataSourceConfig.class)
|
||||
.run((context) -> {
|
||||
CompositeHealthContributor composite = context.getBean(CompositeHealthContributor.class);
|
||||
assertThat(composite.getContributor("dataSource")).isInstanceOf(DataSourceHealthIndicator.class);
|
||||
@@ -85,7 +85,7 @@ class DataSourceHealthContributorAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
void runWithRoutingAndEmbeddedDataSourceShouldNotIncludeRoutingDataSourceWhenIgnored() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class, RoutingDatasourceConfig.class)
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class, RoutingDataSourceConfig.class)
|
||||
.withPropertyValues("management.health.db.ignore-routing-datasources:true").run((context) -> {
|
||||
assertThat(context).doesNotHaveBean(CompositeHealthContributor.class);
|
||||
assertThat(context).hasSingleBean(DataSourceHealthIndicator.class);
|
||||
@@ -95,13 +95,13 @@ class DataSourceHealthContributorAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
void runWithOnlyRoutingDataSourceShouldIncludeRoutingDataSource() {
|
||||
this.contextRunner.withUserConfiguration(RoutingDatasourceConfig.class)
|
||||
this.contextRunner.withUserConfiguration(RoutingDataSourceConfig.class)
|
||||
.run((context) -> assertThat(context).hasSingleBean(RoutingDataSourceHealthIndicator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runWithOnlyRoutingDataSourceShouldCrashWhenIgnored() {
|
||||
this.contextRunner.withUserConfiguration(RoutingDatasourceConfig.class)
|
||||
this.contextRunner.withUserConfiguration(RoutingDataSourceConfig.class)
|
||||
.withPropertyValues("management.health.db.ignore-routing-datasources:true")
|
||||
.run((context) -> assertThat(context).hasFailed().getFailure()
|
||||
.hasRootCauseInstanceOf(IllegalArgumentException.class));
|
||||
@@ -140,7 +140,7 @@ class DataSourceHealthContributorAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class RoutingDatasourceConfig {
|
||||
static class RoutingDataSourceConfig {
|
||||
|
||||
@Bean
|
||||
AbstractRoutingDataSource routingDataSource() {
|
||||
|
||||
@@ -138,10 +138,10 @@ class WebConversionServiceTests {
|
||||
|
||||
private void isoOffsetDateTimeFormat(DateTimeFormatters formatters) {
|
||||
WebConversionService conversionService = new WebConversionService(formatters);
|
||||
OffsetDateTime offsetdate = OffsetDateTime.of(LocalDate.of(2020, 4, 26), LocalTime.of(12, 45, 23),
|
||||
OffsetDateTime offsetDateTime = OffsetDateTime.of(LocalDate.of(2020, 4, 26), LocalTime.of(12, 45, 23),
|
||||
ZoneOffset.ofHoursMinutes(1, 30));
|
||||
assertThat(conversionService.convert(offsetdate, String.class))
|
||||
.isEqualTo(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(offsetdate));
|
||||
assertThat(conversionService.convert(offsetDateTime, String.class))
|
||||
.isEqualTo(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(offsetDateTime));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -2127,7 +2127,7 @@ To register custom metrics, inject `MeterRegistry` into your component, as shown
|
||||
include::{code-examples}/actuate/metrics/MetricsMeterRegistryInjectionExample.java[tag=component]
|
||||
----
|
||||
|
||||
If you metrics depend on other beans, it is recommend that you use a `MeterBinder` to register them, as shown in the following example:
|
||||
If your metrics depend on other beans, it is recommended that you use a `MeterBinder` to register them, as shown in the following example:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@@ -2136,7 +2136,7 @@ include::{code-examples}/actuate/metrics/SampleMeterBinderConfiguration.java[tag
|
||||
|
||||
Using a `MeterBinder` ensures that the correct dependency relationships are set up and that the bean is available when the metric's value is retrieved.
|
||||
By default, metrics from all `MeterBinder` beans will be automatically bound to the Spring-managed `MeterRegistry`.
|
||||
A `MeterBinder` implementation can also be useful if you find that you repeatedly instrument a suite of metrics across components or applications..
|
||||
A `MeterBinder` implementation can also be useful if you find that you repeatedly instrument a suite of metrics across components or applications.
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user