See gh-38389
This commit is contained in:
Johnny Lim 2023-11-19 00:19:30 +09:00 committed by Moritz Halbritter
parent 9c43ed716a
commit 175b6473c7
14 changed files with 23 additions and 32 deletions

View File

@ -30,7 +30,6 @@ import org.springframework.boot.test.context.FilteredClassLoader;
import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.as; import static org.assertj.core.api.Assertions.as;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@ -129,8 +128,7 @@ class WavefrontSenderConfigurationTests {
"management.wavefront.api-token=abcde") "management.wavefront.api-token=abcde")
.run((context) -> { .run((context) -> {
WavefrontSender sender = context.getBean(WavefrontSender.class); WavefrontSender sender = context.getBean(WavefrontSender.class);
Object tokenService = ReflectionTestUtils.getField(sender, "tokenService"); assertThat(sender).extracting("tokenService").isInstanceOf(WavefrontTokenService.class);
assertThat(tokenService).isInstanceOf(WavefrontTokenService.class);
}); });
} }
@ -141,8 +139,7 @@ class WavefrontSenderConfigurationTests {
"management.wavefront.api-token=abcde") "management.wavefront.api-token=abcde")
.run((context) -> { .run((context) -> {
WavefrontSender sender = context.getBean(WavefrontSender.class); WavefrontSender sender = context.getBean(WavefrontSender.class);
Object tokenService = ReflectionTestUtils.getField(sender, "tokenService"); assertThat(sender).extracting("tokenService").isInstanceOf(CSPTokenService.class);
assertThat(tokenService).isInstanceOf(CSPTokenService.class);
}); });
} }
@ -153,8 +150,7 @@ class WavefrontSenderConfigurationTests {
"management.wavefront.api-token=clientid=cid,clientsecret=csec") "management.wavefront.api-token=clientid=cid,clientsecret=csec")
.run((context) -> { .run((context) -> {
WavefrontSender sender = context.getBean(WavefrontSender.class); WavefrontSender sender = context.getBean(WavefrontSender.class);
Object tokenService = ReflectionTestUtils.getField(sender, "tokenService"); assertThat(sender).extracting("tokenService").isInstanceOf(CSPTokenService.class);
assertThat(tokenService).isInstanceOf(CSPTokenService.class);
}); });
} }
@ -162,8 +158,7 @@ class WavefrontSenderConfigurationTests {
void shouldApplyTokenTypeNoToken() { void shouldApplyTokenTypeNoToken() {
this.contextRunner.withPropertyValues("management.wavefront.api-token-type=NO_TOKEN").run((context) -> { this.contextRunner.withPropertyValues("management.wavefront.api-token-type=NO_TOKEN").run((context) -> {
WavefrontSender sender = context.getBean(WavefrontSender.class); WavefrontSender sender = context.getBean(WavefrontSender.class);
Object tokenService = ReflectionTestUtils.getField(sender, "tokenService"); assertThat(sender).extracting("tokenService").isInstanceOf(NoopProxyTokenService.class);
assertThat(tokenService).isInstanceOf(NoopProxyTokenService.class);
}); });
} }

View File

@ -81,7 +81,7 @@ class MailHealthIndicatorTests {
assertThat(health.getDetails()).doesNotContainKey("location"); assertThat(health.getDetails()).doesNotContainKey("location");
Object errorMessage = health.getDetails().get("error"); Object errorMessage = health.getDetails().get("error");
assertThat(errorMessage).isNotNull(); assertThat(errorMessage).isNotNull();
assertThat(errorMessage.toString().contains("A test exception")).isTrue(); assertThat(errorMessage.toString()).contains("A test exception");
} }
@Test @Test
@ -104,7 +104,7 @@ class MailHealthIndicatorTests {
assertThat(health.getDetails().get("location")).isEqualTo(":1234"); assertThat(health.getDetails().get("location")).isEqualTo(":1234");
Object errorMessage = health.getDetails().get("error"); Object errorMessage = health.getDetails().get("error");
assertThat(errorMessage).isNotNull(); assertThat(errorMessage).isNotNull();
assertThat(errorMessage.toString().contains("A test exception")).isTrue(); assertThat(errorMessage.toString()).contains("A test exception");
} }
@Test @Test
@ -125,7 +125,7 @@ class MailHealthIndicatorTests {
assertThat(health.getDetails()).containsEntry("location", "smtp.acme.org"); assertThat(health.getDetails()).containsEntry("location", "smtp.acme.org");
Object errorMessage = health.getDetails().get("error"); Object errorMessage = health.getDetails().get("error");
assertThat(errorMessage).isNotNull(); assertThat(errorMessage).isNotNull();
assertThat(errorMessage.toString().contains("A test exception")).isTrue(); assertThat(errorMessage.toString()).contains("A test exception");
} }
@Test @Test

View File

@ -97,9 +97,9 @@ org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
org.springframework.boot.autoconfigure.pulsar.PulsarAutoConfiguration org.springframework.boot.autoconfigure.pulsar.PulsarAutoConfiguration
org.springframework.boot.autoconfigure.pulsar.PulsarReactiveAutoConfiguration org.springframework.boot.autoconfigure.pulsar.PulsarReactiveAutoConfiguration
org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration
org.springframework.boot.autoconfigure.reactor.ReactorAutoConfiguration
org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration
org.springframework.boot.autoconfigure.r2dbc.R2dbcTransactionManagerAutoConfiguration org.springframework.boot.autoconfigure.r2dbc.R2dbcTransactionManagerAutoConfiguration
org.springframework.boot.autoconfigure.reactor.ReactorAutoConfiguration
org.springframework.boot.autoconfigure.rsocket.RSocketMessagingAutoConfiguration org.springframework.boot.autoconfigure.rsocket.RSocketMessagingAutoConfiguration
org.springframework.boot.autoconfigure.rsocket.RSocketRequesterAutoConfiguration org.springframework.boot.autoconfigure.rsocket.RSocketRequesterAutoConfiguration
org.springframework.boot.autoconfigure.rsocket.RSocketServerAutoConfiguration org.springframework.boot.autoconfigure.rsocket.RSocketServerAutoConfiguration

View File

@ -304,7 +304,7 @@ class JacksonAutoConfigurationTests {
@Test @Test
void disableJsonNodeFeature() { void disableJsonNodeFeature() {
this.contextRunner.withPropertyValues("spring.jackson.datatype.jsonnode.write-null-properties:false") this.contextRunner.withPropertyValues("spring.jackson.datatype.json-node.write-null-properties:false")
.run((context) -> { .run((context) -> {
ObjectMapper mapper = context.getBean(ObjectMapper.class); ObjectMapper mapper = context.getBean(ObjectMapper.class);
assertThat(JsonNodeFeature.WRITE_NULL_PROPERTIES.enabledByDefault()).isTrue(); assertThat(JsonNodeFeature.WRITE_NULL_PROPERTIES.enabledByDefault()).isTrue();

View File

@ -68,7 +68,7 @@ class RestTemplateAutoConfigurationTests {
@Test @Test
void shouldFailOnCustomRestTemplateBuilderConfigurer() { void shouldFailOnCustomRestTemplateBuilderConfigurer() {
this.contextRunner.withUserConfiguration(RestTemplateCustomConfigurerConfig.class) this.contextRunner.withUserConfiguration(RestTemplateBuilderConfigurerConfig.class)
.run((context) -> assertThat(context).getFailure() .run((context) -> assertThat(context).getFailure()
.isInstanceOf(BeanDefinitionOverrideException.class) .isInstanceOf(BeanDefinitionOverrideException.class)
.hasMessageContaining("with name 'restTemplateBuilderConfigurer'")); .hasMessageContaining("with name 'restTemplateBuilderConfigurer'"));
@ -273,7 +273,7 @@ class RestTemplateAutoConfigurationTests {
} }
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
static class RestTemplateCustomConfigurerConfig { static class RestTemplateBuilderConfigurerConfig {
@Bean @Bean
RestTemplateBuilderConfigurer restTemplateBuilderConfigurer() { RestTemplateBuilderConfigurer restTemplateBuilderConfigurer() {

View File

@ -35,4 +35,4 @@ With this Docker Compose file in place, the JDBC URL used is `jdbc:postgresql://
If you want to share services between multiple applications, create the `compose.yaml` file in one of the applications and then use the configuration property configprop:spring.docker.compose.file[] in the other applications to reference the `compose.yaml` file. If you want to share services between multiple applications, create the `compose.yaml` file in one of the applications and then use the configuration property configprop:spring.docker.compose.file[] in the other applications to reference the `compose.yaml` file.
You should also set configprop:spring.docker.compose.lifecycle-management[] to `start-only`, as it defaults to `start-and-stop` and stopping one application would shut down the shared services for the other still running applications, too. You should also set configprop:spring.docker.compose.lifecycle-management[] to `start-only`, as it defaults to `start-and-stop` and stopping one application would shut down the shared services for the other still running applications, too.
Setting it to `start-only` won't stop the shared services on application stop, but a caveat is that if you shut down all applications, the services stay running. Setting it to `start-only` won't stop the shared services on application stop, but a caveat is that if you shut down all applications, the services stay running.
You can stop the services manually by running `docker compose stop` on the commandline in the directory which contains the `compose.yaml` file. You can stop the services manually by running `docker compose stop` on the command line in the directory which contains the `compose.yaml` file.

View File

@ -75,7 +75,7 @@ These features are described in several enums (in Jackson) that map onto propert
| `true`, `false` | `true`, `false`
| `com.fasterxml.jackson.databind.cfg.JsonNodeFeature` | `com.fasterxml.jackson.databind.cfg.JsonNodeFeature`
| `spring.jackson.datatype.jsonnode.<feature_name>` | `spring.jackson.datatype.json-node.<feature_name>`
| `true`, `false` | `true`, `false`
| `com.fasterxml.jackson.databind.DeserializationFeature` | `com.fasterxml.jackson.databind.DeserializationFeature`

View File

@ -12,7 +12,7 @@ If you have Spring WebFlux on your classpath we recommend that you use `WebClien
The `WebClient` interface provides a functional style API and is fully reactive. The `WebClient` interface provides a functional style API and is fully reactive.
You can learn more about the `WebClient` in the dedicated {spring-framework-docs}/web/webflux-webclient.html[section in the Spring Framework docs]. You can learn more about the `WebClient` in the dedicated {spring-framework-docs}/web/webflux-webclient.html[section in the Spring Framework docs].
TIP: If you are not writing a reactive Spring WebFlux application you can use the a <<io#io.rest-client.restclient,`RestClient`>> instead of a `WebClient`. TIP: If you are not writing a reactive Spring WebFlux application you can use the <<io#io.rest-client.restclient,`RestClient`>> instead of a `WebClient`.
This provides a similar functional API, but is blocking rather than reactive. This provides a similar functional API, but is blocking rather than reactive.
Spring Boot creates and pre-configures a prototype `WebClient.Builder` bean for you. Spring Boot creates and pre-configures a prototype `WebClient.Builder` bean for you.

View File

@ -271,7 +271,7 @@ Usually, you would define the properties in your `application.properties` or `ap
Common server settings include: Common server settings include:
* Network settings: Listen port for incoming HTTP requests (`server.port`), interface address to bind to `server.address`, and so on. * Network settings: Listen port for incoming HTTP requests (`server.port`), interface address to bind to (`server.address`), and so on.
* Error management: Location of the error page (`server.error.path`) and so on. * Error management: Location of the error page (`server.error.path`) and so on.
* <<howto#howto.webserver.configure-ssl,SSL>> * <<howto#howto.webserver.configure-ssl,SSL>>
* <<howto#howto.webserver.enable-response-compression,HTTP compression>> * <<howto#howto.webserver.enable-response-compression,HTTP compression>>
@ -291,7 +291,7 @@ The following example shows programmatically setting the port:
include::code:MyWebServerFactoryCustomizer[] include::code:MyWebServerFactoryCustomizer[]
`JettyReactiveWebServerFactory`, `NettyReactiveWebServerFactory`, `TomcatReactiveWebServerFactory`, and `UndertowServletWebServerFactory` are dedicated variants of `ConfigurableReactiveWebServerFactory` that have additional customization setter methods for Jetty, Reactor Netty, Tomcat, and Undertow respectively. `JettyReactiveWebServerFactory`, `NettyReactiveWebServerFactory`, `TomcatReactiveWebServerFactory`, and `UndertowReactiveWebServerFactory` are dedicated variants of `ConfigurableReactiveWebServerFactory` that have additional customization setter methods for Jetty, Reactor Netty, Tomcat, and Undertow respectively.
The following example shows how to customize `NettyReactiveWebServerFactory` that provides access to Reactor Netty-specific configuration options: The following example shows how to customize `NettyReactiveWebServerFactory` that provides access to Reactor Netty-specific configuration options:
include::code:MyNettyWebServerFactoryCustomizer[] include::code:MyNettyWebServerFactoryCustomizer[]

View File

@ -575,7 +575,7 @@ Usually, you would define the properties in your `application.properties` or `ap
Common server settings include: Common server settings include:
* Network settings: Listen port for incoming HTTP requests (`server.port`), interface address to bind to `server.address`, and so on. * Network settings: Listen port for incoming HTTP requests (`server.port`), interface address to bind to (`server.address`), and so on.
* Session settings: Whether the session is persistent (`server.servlet.session.persistent`), session timeout (`server.servlet.session.timeout`), location of session data (`server.servlet.session.store-dir`), and session-cookie configuration (`server.servlet.session.cookie.*`). * Session settings: Whether the session is persistent (`server.servlet.session.persistent`), session timeout (`server.servlet.session.timeout`), location of session data (`server.servlet.session.store-dir`), and session-cookie configuration (`server.servlet.session.cookie.*`).
* Error management: Location of the error page (`server.error.path`) and so on. * Error management: Location of the error page (`server.error.path`) and so on.
* <<howto#howto.webserver.configure-ssl,SSL>> * <<howto#howto.webserver.configure-ssl,SSL>>

View File

@ -30,7 +30,7 @@ bom {
library("C3P0", "0.9.5.5") { library("C3P0", "0.9.5.5") {
group("com.mchange") { group("com.mchange") {
modules = [ modules = [
"c3p0" "c3p0"
] ]
} }
} }
@ -141,7 +141,7 @@ bom {
library("Micrometer Context Propagation", "1.0.5") { library("Micrometer Context Propagation", "1.0.5") {
group("io.micrometer") { group("io.micrometer") {
modules = [ modules = [
"context-propagation" "context-propagation"
] ]
} }
} }

View File

@ -210,9 +210,4 @@ class SpringBootMockMvcBuilderCustomizerTests {
} }
static record RegisteredFilter(Filter filter, Map<String, String> initParameters,
EnumSet<DispatcherType> dispatcherTypes) {
}
} }

View File

@ -40,8 +40,8 @@ import org.springframework.boot.loader.log.DebugLogger;
* contains. Unlike {@link java.util.zip.ZipFile}, this implementation can load content * contains. Unlike {@link java.util.zip.ZipFile}, this implementation can load content
* from a zip file nested inside another file as long as the entry is not compressed. * from a zip file nested inside another file as long as the entry is not compressed.
* <p> * <p>
* In order to reduce memory consumption, this implementation stores only the the hash of * In order to reduce memory consumption, this implementation stores only the hash of the
* the entry names, the central directory offsets and the original positions. Entries are * entry names, the central directory offsets and the original positions. Entries are
* stored internally in {@code hashCode} order so that a binary search can be used to * stored internally in {@code hashCode} order so that a binary search can be used to
* quickly find an entry by name or determine if the zip file doesn't have a given entry. * quickly find an entry by name or determine if the zip file doesn't have a given entry.
* <p> * <p>

View File

@ -1300,7 +1300,8 @@ public class SpringApplication {
} }
/** /**
* Whether to keep the application alive even if there are no more non-daemon threads. * Set whether to keep the application alive even if there are no more non-daemon
* threads.
* @param keepAlive whether to keep the application alive even if there are no more * @param keepAlive whether to keep the application alive even if there are no more
* non-daemon threads * non-daemon threads
* @since 3.2.0 * @since 3.2.0