Browse Source

Merge pull request #35185 from izeye

* pr/35185:
  Polish

Closes gh-35185
pull/35417/head
Moritz Halbritter 3 years ago
parent
commit
cb2773da21
  1. 2
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/otlp/OtlpProperties.java
  2. 8
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/otlp/OtlpAutoConfigurationIntegrationTests.java
  3. 2
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherApplicationRunner.java
  4. 1
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfigurationTests.java
  5. 10
      spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/tracing.adoc
  6. 2
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/DefaultTimeZoneOffset.java
  7. 2
      spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/DefaultTimeZoneOffset.java
  8. 1
      spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/process/DisabledIfProcessUnavailable.java
  9. 4
      spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/process/DisabledIfProcessUnavailableCondition.java
  10. 3
      spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/process/DisabledIfProcessUnavailables.java
  11. 4
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java
  12. 3
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/DefaultBindConstructorProvider.java

2
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 { @@ -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;

8
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 { @@ -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 { @@ -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");
}
});
}

2
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; @@ -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

1
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfigurationTests.java

@ -97,7 +97,6 @@ class JmxAutoConfigurationTests { @@ -97,7 +97,6 @@ class JmxAutoConfigurationTests {
"namingStrategy");
assertThat(naming).hasFieldOrPropertyWithValue("defaultDomain", "my-test-domain");
assertThat(naming).hasFieldOrPropertyWithValue("ensureUniqueRuntimeObjectNames", true);
});
}

10
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 @@ -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 @@ -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 @@ -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.

2
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; @@ -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.
*

2
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; @@ -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.
*

1
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; @@ -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)

4
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 { @@ -57,8 +57,8 @@ class DisabledIfProcessUnavailableCondition implements ExecutionCondition {
}
}
private Stream<String[]> getAnnotationValue(AnnotatedElement testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.TYPE_HIERARCHY)
private Stream<String[]> getAnnotationValue(AnnotatedElement testElement) {
return MergedAnnotations.from(testElement, SearchStrategy.TYPE_HIERARCHY)
.stream(DisabledIfProcessUnavailable.class)
.map((annotation) -> annotation.getStringArray(MergedAnnotation.VALUE));
}

3
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; @@ -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)

4
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java

@ -1364,8 +1364,8 @@ public class SpringApplication { @@ -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)
*/

3
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/DefaultBindConstructorProvider.java

@ -102,7 +102,6 @@ class DefaultBindConstructorProvider implements BindConstructorProvider { @@ -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 { @@ -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;
}

Loading…
Cancel
Save