Skip to content

Polish #22740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Polish #22740

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void runWhenMultipleDataSourceBeansShouldCreateCompositeIndicator() {

@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);
Expand All @@ -85,7 +85,7 @@ void runWithRoutingAndEmbeddedDataSourceShouldIncludeRoutingDataSource() {

@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);
Expand All @@ -95,13 +95,13 @@ void runWithRoutingAndEmbeddedDataSourceShouldNotIncludeRoutingDataSourceWhenIgn

@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));
Expand Down Expand Up @@ -140,7 +140,7 @@ DataSource testDataSource() {
}

@Configuration(proxyBeanMethods = false)
static class RoutingDatasourceConfig {
static class RoutingDataSourceConfig {

@Bean
AbstractRoutingDataSource routingDataSource() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ void hyphenatedIsoOffsetDateTimeFormat() {

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
----
Expand All @@ -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.



Expand Down