mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Polish
See gh-33108
This commit is contained in:
parent
1df948c7ca
commit
6027508cf7
@ -59,8 +59,7 @@ class ServerRequestObservationConventionAdapter implements ServerRequestObservat
|
|||||||
}
|
}
|
||||||
|
|
||||||
ServerRequestObservationConventionAdapter(String name, List<WebFluxTagsContributor> contributors) {
|
ServerRequestObservationConventionAdapter(String name, List<WebFluxTagsContributor> contributors) {
|
||||||
this.name = name;
|
this(name, new DefaultWebFluxTagsProvider(contributors));
|
||||||
this.tagsProvider = new DefaultWebFluxTagsProvider(contributors);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,7 +24,7 @@ import org.springframework.http.HttpMethod;
|
|||||||
import org.springframework.web.client.RestTemplate;
|
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 Moritz Halbritter
|
||||||
* @author Stefan Bratanov
|
* @author Stefan Bratanov
|
||||||
|
@ -25,7 +25,7 @@ import org.springframework.http.ResponseEntity;
|
|||||||
import org.springframework.web.reactive.function.client.WebClient;
|
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
|
* @author Stefan Bratanov
|
||||||
*/
|
*/
|
||||||
|
@ -21,6 +21,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import io.micrometer.common.KeyValue;
|
import io.micrometer.common.KeyValue;
|
||||||
import io.micrometer.core.instrument.Tag;
|
import io.micrometer.core.instrument.Tag;
|
||||||
|
import io.micrometer.core.instrument.Tags;
|
||||||
import io.micrometer.observation.Observation;
|
import io.micrometer.observation.Observation;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
@ -96,7 +97,7 @@ class ServerRequestObservationConventionAdapterTests {
|
|||||||
@Override
|
@Override
|
||||||
public Iterable<Tag> getTags(HttpServletRequest request, HttpServletResponse response, Object handler,
|
public Iterable<Tag> getTags(HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||||
Throwable exception) {
|
Throwable exception) {
|
||||||
return List.of(Tag.of("custom", "value"));
|
return Tags.of("custom", "value");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,7 +27,7 @@ package org.springframework.boot.actuate.health;
|
|||||||
public interface HttpCodeStatusMapper {
|
public interface HttpCodeStatusMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link HttpCodeStatusMapper} instance using default mappings.
|
* An {@link HttpCodeStatusMapper} instance using default mappings.
|
||||||
* @since 2.3.0
|
* @since 2.3.0
|
||||||
*/
|
*/
|
||||||
HttpCodeStatusMapper DEFAULT = new SimpleHttpCodeStatusMapper();
|
HttpCodeStatusMapper DEFAULT = new SimpleHttpCodeStatusMapper();
|
||||||
|
@ -63,7 +63,7 @@ public class MongoProperties {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional server hosts. Cannot be set with URI or if 'host' is not specified.
|
* 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.
|
* different port you can use the "host:port" syntax.
|
||||||
*/
|
*/
|
||||||
private List<String> additionalHosts;
|
private List<String> additionalHosts;
|
||||||
|
@ -81,7 +81,7 @@ class ConditionEvaluationReportLoggingListenerTests {
|
|||||||
assertThatExceptionOfType(Exception.class).isThrownBy(context::refresh)
|
assertThatExceptionOfType(Exception.class).isThrownBy(context::refresh)
|
||||||
.satisfies((ex) -> withInfoLogging(() -> context.publishEvent(
|
.satisfies((ex) -> withInfoLogging(() -> context.publishEvent(
|
||||||
new ApplicationFailedEvent(new SpringApplication(), new String[0], context, ex))));
|
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");
|
.contains("re-run your application with 'debug' enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.
|
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.
|
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.
|
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.
|
||||||
|
|
||||||
|
@ -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
|
==== Auto-configured Data JDBC Tests
|
||||||
`@DataJdbcTest` is similar to `@JdbcTest` but is for tests that use Spring Data JDBC repositories.
|
`@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.
|
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.
|
`@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>>.
|
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>>.
|
||||||
|
@ -44,7 +44,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
* Data JDBC components.
|
* Data JDBC components.
|
||||||
* <p>
|
* <p>
|
||||||
* Using this annotation will disable full auto-configuration, scan for
|
* 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.
|
* Data JDBC tests.
|
||||||
* <p>
|
* <p>
|
||||||
* By default, tests annotated with {@code @DataJdbcTest} are transactional and roll back
|
* By default, tests annotated with {@code @DataJdbcTest} are transactional and roll back
|
||||||
|
@ -20,7 +20,6 @@ import java.util.Collections;
|
|||||||
|
|
||||||
import io.micrometer.tracing.Tracer;
|
import io.micrometer.tracing.Tracer;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.Mockito;
|
|
||||||
|
|
||||||
import org.springframework.boot.context.annotation.UserConfigurations;
|
import org.springframework.boot.context.annotation.UserConfigurations;
|
||||||
import org.springframework.boot.test.context.FilteredClassLoader;
|
import org.springframework.boot.test.context.FilteredClassLoader;
|
||||||
@ -33,6 +32,7 @@ import org.springframework.context.support.GenericApplicationContext;
|
|||||||
import org.springframework.test.context.ContextCustomizer;
|
import org.springframework.test.context.ContextCustomizer;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link AutoConfigureObservability} and
|
* Tests for {@link AutoConfigureObservability} and
|
||||||
@ -197,7 +197,7 @@ class ObservabilityContextCustomizerFactoryTests {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
Tracer customTracer() {
|
Tracer customTracer() {
|
||||||
return Mockito.mock(Tracer.class);
|
return mock(Tracer.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -354,8 +354,7 @@ class SpringBootContextLoaderTests {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
@SpringBootConfiguration(proxyBeanMethods = false)
|
||||||
@SpringBootConfiguration
|
|
||||||
public static class ConfigWithMain {
|
public static class ConfigWithMain {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
@ -364,14 +363,12 @@ class SpringBootContextLoaderTests {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
@SpringBootConfiguration(proxyBeanMethods = false)
|
||||||
@SpringBootConfiguration
|
|
||||||
static class ConfigWithNoMain {
|
static class ConfigWithNoMain {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
@SpringBootConfiguration(proxyBeanMethods = false)
|
||||||
@SpringBootConfiguration
|
|
||||||
public static class ConfigWithMainWithBeanThrowingException {
|
public static class ConfigWithMainWithBeanThrowingException {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
@ -385,8 +382,7 @@ class SpringBootContextLoaderTests {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
@SpringBootConfiguration(proxyBeanMethods = false)
|
||||||
@SpringBootConfiguration
|
|
||||||
static class ConfigWithNoMainWithBeanThrowingException {
|
static class ConfigWithNoMainWithBeanThrowingException {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ -396,8 +392,7 @@ class SpringBootContextLoaderTests {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
@SpringBootConfiguration(proxyBeanMethods = false)
|
||||||
@SpringBootConfiguration
|
|
||||||
public static class ConfigWithMainThrowingException {
|
public static class ConfigWithMainThrowingException {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -23,7 +23,6 @@ import org.springframework.boot.SpringApplication;
|
|||||||
import org.springframework.boot.SpringBootConfiguration;
|
import org.springframework.boot.SpringBootConfiguration;
|
||||||
import org.springframework.boot.test.context.SpringBootTest.UseMainMethod;
|
import org.springframework.boot.test.context.SpringBootTest.UseMainMethod;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
@ -44,8 +43,7 @@ class SpringBootTestUseMainMethodWithPropertiesTests {
|
|||||||
assertThat(this.applicationContext.getEnvironment().getProperty("test")).isEqualTo("123");
|
assertThat(this.applicationContext.getEnvironment().getProperty("test")).isEqualTo("123");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
@SpringBootConfiguration(proxyBeanMethods = false)
|
||||||
@SpringBootConfiguration
|
|
||||||
public static class ConfigWithMain {
|
public static class ConfigWithMain {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -205,7 +205,7 @@ class PropertyDescriptorResolver {
|
|||||||
MetadataGenerationEnvironment env) {
|
MetadataGenerationEnvironment env) {
|
||||||
if (constructors.size() == 1) {
|
if (constructors.size() == 1) {
|
||||||
ExecutableElement candidate = constructors.get(0);
|
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
|
if (type.getNestingKind() == NestingKind.MEMBER
|
||||||
&& candidate.getModifiers().contains(Modifier.PRIVATE)) {
|
&& candidate.getModifiers().contains(Modifier.PRIVATE)) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -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.
|
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.
|
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 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.
|
The `nativeTest` task of the GraalVM Native Image plugin is automatically configured to use the output of the `processAot` and `processTestAot` tasks.
|
@ -33,7 +33,7 @@ import org.xnio.XnioWorker;
|
|||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link HttpHandlerFactory} for an {@link AccessLogHandler}.
|
* An {@link HttpHandlerFactory} for an {@link AccessLogHandler}.
|
||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user