See gh-33108
This commit is contained in:
Johnny Lim 2022-11-11 22:34:43 +09:00 committed by Stephane Nicoll
parent 1df948c7ca
commit 6027508cf7
16 changed files with 22 additions and 29 deletions

View File

@ -59,8 +59,7 @@ class ServerRequestObservationConventionAdapter implements ServerRequestObservat
}
ServerRequestObservationConventionAdapter(String name, List<WebFluxTagsContributor> contributors) {
this.name = name;
this.tagsProvider = new DefaultWebFluxTagsProvider(contributors);
this(name, new DefaultWebFluxTagsProvider(contributors));
}
@Override

View File

@ -24,7 +24,7 @@ import org.springframework.http.HttpMethod;
import org.springframework.web.client.RestTemplate;
/**
* A {@link HttpSender} which uses {@link RestTemplate} for HTTP communication.
* An {@link HttpSender} which uses {@link RestTemplate} for HTTP communication.
*
* @author Moritz Halbritter
* @author Stefan Bratanov

View File

@ -25,7 +25,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.reactive.function.client.WebClient;
/**
* A {@link HttpSender} which uses {@link WebClient} for HTTP communication.
* An {@link HttpSender} which uses {@link WebClient} for HTTP communication.
*
* @author Stefan Bratanov
*/

View File

@ -21,6 +21,7 @@ import java.util.List;
import io.micrometer.common.KeyValue;
import io.micrometer.core.instrument.Tag;
import io.micrometer.core.instrument.Tags;
import io.micrometer.observation.Observation;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@ -96,7 +97,7 @@ class ServerRequestObservationConventionAdapterTests {
@Override
public Iterable<Tag> getTags(HttpServletRequest request, HttpServletResponse response, Object handler,
Throwable exception) {
return List.of(Tag.of("custom", "value"));
return Tags.of("custom", "value");
}
@Override

View File

@ -27,7 +27,7 @@ package org.springframework.boot.actuate.health;
public interface HttpCodeStatusMapper {
/**
* A {@link HttpCodeStatusMapper} instance using default mappings.
* An {@link HttpCodeStatusMapper} instance using default mappings.
* @since 2.3.0
*/
HttpCodeStatusMapper DEFAULT = new SimpleHttpCodeStatusMapper();

View File

@ -63,7 +63,7 @@ public class MongoProperties {
/**
* Additional server hosts. Cannot be set with URI or if 'host' is not specified.
* Additional hosts will use the default mongo port of 27017, if you want to use a
* Additional hosts will use the default mongo port of 27017. If you want to use a
* different port you can use the "host:port" syntax.
*/
private List<String> additionalHosts;

View File

@ -81,7 +81,7 @@ class ConditionEvaluationReportLoggingListenerTests {
assertThatExceptionOfType(Exception.class).isThrownBy(context::refresh)
.satisfies((ex) -> withInfoLogging(() -> context.publishEvent(
new ApplicationFailedEvent(new SpringApplication(), new String[0], context, ex))));
assertThat(output).doesNotContain("CONDITONS EVALUATION REPORT")
assertThat(output).doesNotContain("CONDITIONS EVALUATION REPORT")
.contains("re-run your application with 'debug' enabled");
}

View File

@ -516,7 +516,7 @@ The following example `scrape_config` adds to `prometheus.yml`:
----
https://prometheus.io/docs/prometheus/latest/feature_flags/#exemplars-storage[Prometheus Exemplars] are also supported.
To enable this feature, a `SpanContextSupplier` bean should present.
To enable this feature, a `SpanContextSupplier` bean should be present.
If you use https://micrometer.io/docs/tracing[Micrometer Tracing], this will be auto-configured for you, but you can always create your own if you want.
Please check the https://prometheus.io/docs/prometheus/latest/feature_flags/#exemplars-storage[Prometheus Docs], since this feature needs to be explicitly enabled on Prometheus' side, and it is only supported using the https://github.com/OpenObservability/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#exemplars[OpenMetrics] format.

View File

@ -579,7 +579,7 @@ If you prefer your test to run against a real database, you can use the `@AutoCo
==== Auto-configured Data JDBC Tests
`@DataJdbcTest` is similar to `@JdbcTest` but is for tests that use Spring Data JDBC repositories.
By default, it configures an in-memory embedded database, a `JdbcTemplate`, and Spring Data JDBC repositories.
Only `AbstractJdbcConfiguration` sub-classes are scanned when the `@DataJdbcTest` annotation is used, regular `@Component` and `@ConfigurationProperties` beans are not scanned.
Only `AbstractJdbcConfiguration` subclasses are scanned when the `@DataJdbcTest` annotation is used, regular `@Component` and `@ConfigurationProperties` beans are not scanned.
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
TIP: A list of the auto-configurations that are enabled by `@DataJdbcTest` can be <<test-auto-configuration#appendix.test-auto-configuration,found in the appendix>>.

View File

@ -44,7 +44,7 @@ import org.springframework.transaction.annotation.Transactional;
* Data JDBC components.
* <p>
* Using this annotation will disable full auto-configuration, scan for
* {@code AbstractJdbcConfiguration} sub-classes, and apply only configuration relevant to
* {@code AbstractJdbcConfiguration} subclasses, and apply only configuration relevant to
* Data JDBC tests.
* <p>
* By default, tests annotated with {@code @DataJdbcTest} are transactional and roll back

View File

@ -20,7 +20,6 @@ import java.util.Collections;
import io.micrometer.tracing.Tracer;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.boot.context.annotation.UserConfigurations;
import org.springframework.boot.test.context.FilteredClassLoader;
@ -33,6 +32,7 @@ import org.springframework.context.support.GenericApplicationContext;
import org.springframework.test.context.ContextCustomizer;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
/**
* Tests for {@link AutoConfigureObservability} and
@ -197,7 +197,7 @@ class ObservabilityContextCustomizerFactoryTests {
@Bean
Tracer customTracer() {
return Mockito.mock(Tracer.class);
return mock(Tracer.class);
}
}

View File

@ -354,8 +354,7 @@ class SpringBootContextLoaderTests {
}
@Configuration(proxyBeanMethods = false)
@SpringBootConfiguration
@SpringBootConfiguration(proxyBeanMethods = false)
public static class ConfigWithMain {
public static void main(String[] args) {
@ -364,14 +363,12 @@ class SpringBootContextLoaderTests {
}
@Configuration(proxyBeanMethods = false)
@SpringBootConfiguration
@SpringBootConfiguration(proxyBeanMethods = false)
static class ConfigWithNoMain {
}
@Configuration(proxyBeanMethods = false)
@SpringBootConfiguration
@SpringBootConfiguration(proxyBeanMethods = false)
public static class ConfigWithMainWithBeanThrowingException {
public static void main(String[] args) {
@ -385,8 +382,7 @@ class SpringBootContextLoaderTests {
}
@Configuration(proxyBeanMethods = false)
@SpringBootConfiguration
@SpringBootConfiguration(proxyBeanMethods = false)
static class ConfigWithNoMainWithBeanThrowingException {
@Bean
@ -396,8 +392,7 @@ class SpringBootContextLoaderTests {
}
@Configuration(proxyBeanMethods = false)
@SpringBootConfiguration
@SpringBootConfiguration(proxyBeanMethods = false)
public static class ConfigWithMainThrowingException {
public static void main(String[] args) {

View File

@ -23,7 +23,6 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.test.context.SpringBootTest.UseMainMethod;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;
import static org.assertj.core.api.Assertions.assertThat;
@ -44,8 +43,7 @@ class SpringBootTestUseMainMethodWithPropertiesTests {
assertThat(this.applicationContext.getEnvironment().getProperty("test")).isEqualTo("123");
}
@Configuration(proxyBeanMethods = false)
@SpringBootConfiguration
@SpringBootConfiguration(proxyBeanMethods = false)
public static class ConfigWithMain {
public static void main(String[] args) {

View File

@ -205,7 +205,7 @@ class PropertyDescriptorResolver {
MetadataGenerationEnvironment env) {
if (constructors.size() == 1) {
ExecutableElement candidate = constructors.get(0);
if (candidate.getParameters().size() > 0 && !env.hasAutowiredAnnotation(constructors.get(0))) {
if (candidate.getParameters().size() > 0 && !env.hasAutowiredAnnotation(candidate)) {
if (type.getNestingKind() == NestingKind.MEMBER
&& candidate.getModifiers().contains(Modifier.PRIVATE)) {
return null;

View File

@ -38,6 +38,6 @@ The `nativeCompile` task of the GraalVM Native Image plugin is automatically con
The AOT engine can be applied to JUnit 5 tests that use Spring's Test Context Framework.
Suitable tests are processed by the `processTestAot` task to generate `ApplicationContextInitialzer` code.
As with application AOT processing, the `BeanFactory` is fully prepared at build-time.
As with `processAot`, the `processTestAot` task is `JavaExec` sub-class and can be configured as needed to influence this processing.
As with `processAot`, the `processTestAot` task is `JavaExec` subclass and can be configured as needed to influence this processing.
The `nativeTest` task of the GraalVM Native Image plugin is automatically configured to use the output of the `processAot` and `processTestAot` tasks.

View File

@ -33,7 +33,7 @@ import org.xnio.XnioWorker;
import org.springframework.util.Assert;
/**
* A {@link HttpHandlerFactory} for an {@link AccessLogHandler}.
* An {@link HttpHandlerFactory} for an {@link AccessLogHandler}.
*
* @author Andy Wilkinson
*/