From ff9fd1abebaefdec3eba9734bb21df8faf223461 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Fri, 28 Apr 2023 01:02:02 +0900 Subject: [PATCH] Polish See gh-35185 --- .../autoconfigure/tracing/otlp/OtlpProperties.java | 2 +- .../otlp/OtlpAutoConfigurationIntegrationTests.java | 8 ++++---- .../batch/JobLauncherApplicationRunner.java | 2 +- .../autoconfigure/jmx/JmxAutoConfigurationTests.java | 1 - .../src/docs/asciidoc/actuator/tracing.adoc | 10 +++++----- .../gradle/tasks/bundling/DefaultTimeZoneOffset.java | 2 +- .../boot/loader/tools/DefaultTimeZoneOffset.java | 2 +- .../process/DisabledIfProcessUnavailable.java | 1 + .../process/DisabledIfProcessUnavailableCondition.java | 4 ++-- .../process/DisabledIfProcessUnavailables.java | 3 ++- .../org/springframework/boot/SpringApplication.java | 4 ++-- .../bind/DefaultBindConstructorProvider.java | 3 +-- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/otlp/OtlpProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/otlp/OtlpProperties.java index d0270433c3..efb1a32f75 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/otlp/OtlpProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/otlp/OtlpProperties.java @@ -45,7 +45,7 @@ public class OtlpProperties { private Duration timeout = Duration.ofSeconds(10); /** - * The method used to compress the payload. + * Method used to compress the payload. */ private Compression compression = Compression.NONE; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/otlp/OtlpAutoConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/otlp/OtlpAutoConfigurationIntegrationTests.java index a6e853bd27..47fbcc824a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/otlp/OtlpAutoConfigurationIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/otlp/OtlpAutoConfigurationIntegrationTests.java @@ -67,7 +67,7 @@ class OtlpAutoConfigurationIntegrationTests { } @Test - void httpSpanExporterShouldUseProtoBufAndNoCompressionByDefault() { + void httpSpanExporterShouldUseProtobufAndNoCompressionByDefault() { this.mockWebServer.enqueue(new MockResponse()); this.contextRunner .withPropertyValues("management.otlp.tracing.endpoint=http://localhost:%d/v1/traces" @@ -105,9 +105,9 @@ class OtlpAutoConfigurationIntegrationTests { assertThat(request.getHeader("Content-Type")).isEqualTo("application/x-protobuf"); assertThat(request.getHeader("Content-Encoding")).isEqualTo("gzip"); assertThat(request.getBodySize()).isPositive(); - try (Buffer unCompressed = new Buffer(); Buffer body = request.getBody()) { - unCompressed.writeAll(new GzipSource(body)); - assertThat(unCompressed.readString(StandardCharsets.UTF_8)).contains("org.springframework.boot"); + try (Buffer uncompressed = new Buffer(); Buffer body = request.getBody()) { + uncompressed.writeAll(new GzipSource(body)); + assertThat(uncompressed.readString(StandardCharsets.UTF_8)).contains("org.springframework.boot"); } }); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherApplicationRunner.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherApplicationRunner.java index a6532ee716..7be6c237a2 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherApplicationRunner.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherApplicationRunner.java @@ -59,7 +59,7 @@ import org.springframework.util.StringUtils; /** * {@link ApplicationRunner} to {@link JobLauncher launch} Spring Batch jobs. If a single * job is found in the context, it will be executed by default. If multiple jobs are - * found, launch a specific job by providing a jobName + * found, launch a specific job by providing a jobName. * * @author Dave Syer * @author Jean-Pierre Bergamin diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfigurationTests.java index c0aea16cc1..d29c5d9bf8 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfigurationTests.java @@ -97,7 +97,6 @@ class JmxAutoConfigurationTests { "namingStrategy"); assertThat(naming).hasFieldOrPropertyWithValue("defaultDomain", "my-test-domain"); assertThat(naming).hasFieldOrPropertyWithValue("ensureUniqueRuntimeObjectNames", true); - }); } diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/tracing.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/tracing.adoc index 33bc92830c..b1a635fc6e 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/tracing.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/tracing.adoc @@ -30,8 +30,8 @@ NOTE: There's an added logger statement in the `home()` method, which will be im Now we have to add the following dependencies: * `org.springframework.boot:spring-boot-starter-actuator` -* `io.micrometer:micrometer-tracing-bridge-otel` - which is needed to bridge the Micrometer Observation API to OpenTelemetry. -* `io.opentelemetry:opentelemetry-exporter-zipkin` - which is needed to report https://micrometer.io/docs/tracing#_glossary[traces] to Zipkin. +* `io.micrometer:micrometer-tracing-bridge-otel` - bridges the Micrometer Observation API to OpenTelemetry. +* `io.opentelemetry:opentelemetry-exporter-zipkin` - reports https://micrometer.io/docs/tracing#_glossary[traces] to Zipkin. Add the following application properties: @@ -101,7 +101,7 @@ Use the `management.wavefront.*` configuration properties to configure reporting Tracing with OpenTelemetry and reporting using OTLP requires the following dependencies: * `io.micrometer:micrometer-tracing-bridge-otel` - bridges the Micrometer Observation API to OpenTelemetry. -* `io.opentelemetry:opentelemetry-exporter-otlp` - report traces to a collector that can accept OTLP. +* `io.opentelemetry:opentelemetry-exporter-otlp` - reports traces to a collector that can accept OTLP. Use the `management.otlp.tracing.*` configuration properties to configure reporting using OTLP. @@ -124,8 +124,8 @@ Use the `management.zipkin.tracing.*` configuration properties to configure repo ==== OpenZipkin Brave With Wavefront Tracing with OpenZipkin Brave and reporting to Wavefront requires the following dependencies: -* `io.micrometer:micrometer-tracing-bridge-brave` - which is needed to bridge the Micrometer Observation API to Brave. -* `io.micrometer:micrometer-tracing-reporter-wavefront` - which is needed to report traces to Wavefront. +* `io.micrometer:micrometer-tracing-bridge-brave` - bridges the Micrometer Observation API to Brave. +* `io.micrometer:micrometer-tracing-reporter-wavefront` - reports traces to Wavefront. Use the `management.wavefront.*` configuration properties to configure reporting to Wavefront. diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/DefaultTimeZoneOffset.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/DefaultTimeZoneOffset.java index 449c339936..a31eec9b8b 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/DefaultTimeZoneOffset.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/DefaultTimeZoneOffset.java @@ -21,7 +21,7 @@ import java.util.TimeZone; import java.util.zip.ZipEntry; /** - * Utility class that can be used change a UTC time based on the + * Utility class that can be used to change a UTC time based on the * {@link java.util.TimeZone#getDefault() default TimeZone}. This is required because * {@link ZipEntry#setTime(long)} expects times in the default timezone and not UTC. * diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/DefaultTimeZoneOffset.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/DefaultTimeZoneOffset.java index e7cc93ccbd..e6ac96a916 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/DefaultTimeZoneOffset.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/DefaultTimeZoneOffset.java @@ -21,7 +21,7 @@ import java.util.TimeZone; import java.util.zip.ZipEntry; /** - * Utility class that can be used change a UTC time based on the + * Utility class that can be used to change a UTC time based on the * {@link java.util.TimeZone#getDefault() default TimeZone}. This is required because * {@link ZipEntry#setTime(long)} expects times in the default timezone and not UTC. * diff --git a/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/process/DisabledIfProcessUnavailable.java b/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/process/DisabledIfProcessUnavailable.java index faac6707bb..4dc48e7a37 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/process/DisabledIfProcessUnavailable.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/process/DisabledIfProcessUnavailable.java @@ -29,6 +29,7 @@ import org.junit.jupiter.api.extension.ExtendWith; * Disables test execution if a process is unavailable. * * @author Phillip Webb + * @since 3.1.0 */ @Target({ ElementType.TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/process/DisabledIfProcessUnavailableCondition.java b/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/process/DisabledIfProcessUnavailableCondition.java index 9c8a5990b6..f3b9a1b2b6 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/process/DisabledIfProcessUnavailableCondition.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/process/DisabledIfProcessUnavailableCondition.java @@ -57,8 +57,8 @@ class DisabledIfProcessUnavailableCondition implements ExecutionCondition { } } - private Stream getAnnotationValue(AnnotatedElement testClass) { - return MergedAnnotations.from(testClass, SearchStrategy.TYPE_HIERARCHY) + private Stream getAnnotationValue(AnnotatedElement testElement) { + return MergedAnnotations.from(testElement, SearchStrategy.TYPE_HIERARCHY) .stream(DisabledIfProcessUnavailable.class) .map((annotation) -> annotation.getStringArray(MergedAnnotation.VALUE)); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/process/DisabledIfProcessUnavailables.java b/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/process/DisabledIfProcessUnavailables.java index 7804d65634..62a04d08c4 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/process/DisabledIfProcessUnavailables.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/process/DisabledIfProcessUnavailables.java @@ -25,9 +25,10 @@ import java.lang.annotation.Target; import org.junit.jupiter.api.extension.ExtendWith; /** - * Repeatable container for {@link DisabledIfProcessUnavailables}. + * Repeatable container for {@link DisabledIfProcessUnavailable}. * * @author Phillip Webb + * @since 3.1.0 */ @Target({ ElementType.TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index 28ea16bf88..194a38940a 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -1364,8 +1364,8 @@ public class SpringApplication { * writing a test harness that needs to start an application with additional * configuration. * @param main the main method entry point that runs the {@link SpringApplication} - * @return an {@link SpringApplication.Augmented} instance that can be used to add - * configuration and run the application. + * @return a {@link SpringApplication.Augmented} instance that can be used to add + * configuration and run the application * @since 3.1.0 * @see #withHook(SpringApplicationHook, Runnable) */ diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/DefaultBindConstructorProvider.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/DefaultBindConstructorProvider.java index 4102a97e45..54b454ebca 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/DefaultBindConstructorProvider.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/DefaultBindConstructorProvider.java @@ -102,7 +102,6 @@ class DefaultBindConstructorProvider implements BindConstructorProvider { boolean hasAutowiredConstructor = isAutowiredPresent(type); Constructor[] candidates = getCandidateConstructors(type); MergedAnnotations[] candidateAnnotations = getAnnotations(candidates); - boolean kotlinType = isKotlinType(type); boolean deducedBindConstructor = false; boolean immutableType = type.isRecord(); Constructor bind = getConstructorBindingAnnotated(type, candidates, candidateAnnotations); @@ -110,7 +109,7 @@ class DefaultBindConstructorProvider implements BindConstructorProvider { bind = deduceBindConstructor(type, candidates); deducedBindConstructor = bind != null; } - if (bind == null && !hasAutowiredConstructor && kotlinType) { + if (bind == null && !hasAutowiredConstructor && isKotlinType(type)) { bind = deduceKotlinBindConstructor(type); deducedBindConstructor = bind != null; }