From 175b6473c703b88f5e62f3f7358593a66f774004 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Sun, 19 Nov 2023 00:19:30 +0900 Subject: [PATCH] Polish See gh-38389 --- .../WavefrontSenderConfigurationTests.java | 13 ++++--------- .../boot/actuate/mail/MailHealthIndicatorTests.java | 6 +++--- ...ork.boot.autoconfigure.AutoConfiguration.imports | 2 +- .../jackson/JacksonAutoConfigurationTests.java | 2 +- .../client/RestTemplateAutoConfigurationTests.java | 4 ++-- .../src/docs/asciidoc/howto/docker-compose.adoc | 2 +- .../src/docs/asciidoc/howto/spring-mvc.adoc | 2 +- .../src/docs/asciidoc/io/rest-client.adoc | 2 +- .../src/docs/asciidoc/web/reactive.adoc | 4 ++-- .../src/docs/asciidoc/web/servlet.adoc | 2 +- spring-boot-project/spring-boot-parent/build.gradle | 4 ++-- .../SpringBootMockMvcBuilderCustomizerTests.java | 5 ----- .../springframework/boot/loader/zip/ZipContent.java | 4 ++-- .../org/springframework/boot/SpringApplication.java | 3 ++- 14 files changed, 23 insertions(+), 32 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontSenderConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontSenderConfigurationTests.java index 6091baf221a..512fd831174 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontSenderConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontSenderConfigurationTests.java @@ -30,7 +30,6 @@ import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Bean; 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.assertThat; @@ -129,8 +128,7 @@ class WavefrontSenderConfigurationTests { "management.wavefront.api-token=abcde") .run((context) -> { WavefrontSender sender = context.getBean(WavefrontSender.class); - Object tokenService = ReflectionTestUtils.getField(sender, "tokenService"); - assertThat(tokenService).isInstanceOf(WavefrontTokenService.class); + assertThat(sender).extracting("tokenService").isInstanceOf(WavefrontTokenService.class); }); } @@ -141,8 +139,7 @@ class WavefrontSenderConfigurationTests { "management.wavefront.api-token=abcde") .run((context) -> { WavefrontSender sender = context.getBean(WavefrontSender.class); - Object tokenService = ReflectionTestUtils.getField(sender, "tokenService"); - assertThat(tokenService).isInstanceOf(CSPTokenService.class); + assertThat(sender).extracting("tokenService").isInstanceOf(CSPTokenService.class); }); } @@ -153,8 +150,7 @@ class WavefrontSenderConfigurationTests { "management.wavefront.api-token=clientid=cid,clientsecret=csec") .run((context) -> { WavefrontSender sender = context.getBean(WavefrontSender.class); - Object tokenService = ReflectionTestUtils.getField(sender, "tokenService"); - assertThat(tokenService).isInstanceOf(CSPTokenService.class); + assertThat(sender).extracting("tokenService").isInstanceOf(CSPTokenService.class); }); } @@ -162,8 +158,7 @@ class WavefrontSenderConfigurationTests { void shouldApplyTokenTypeNoToken() { this.contextRunner.withPropertyValues("management.wavefront.api-token-type=NO_TOKEN").run((context) -> { WavefrontSender sender = context.getBean(WavefrontSender.class); - Object tokenService = ReflectionTestUtils.getField(sender, "tokenService"); - assertThat(tokenService).isInstanceOf(NoopProxyTokenService.class); + assertThat(sender).extracting("tokenService").isInstanceOf(NoopProxyTokenService.class); }); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mail/MailHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mail/MailHealthIndicatorTests.java index 88fda8cead0..9abfbedd88d 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mail/MailHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mail/MailHealthIndicatorTests.java @@ -81,7 +81,7 @@ class MailHealthIndicatorTests { assertThat(health.getDetails()).doesNotContainKey("location"); Object errorMessage = health.getDetails().get("error"); assertThat(errorMessage).isNotNull(); - assertThat(errorMessage.toString().contains("A test exception")).isTrue(); + assertThat(errorMessage.toString()).contains("A test exception"); } @Test @@ -104,7 +104,7 @@ class MailHealthIndicatorTests { assertThat(health.getDetails().get("location")).isEqualTo(":1234"); Object errorMessage = health.getDetails().get("error"); assertThat(errorMessage).isNotNull(); - assertThat(errorMessage.toString().contains("A test exception")).isTrue(); + assertThat(errorMessage.toString()).contains("A test exception"); } @Test @@ -125,7 +125,7 @@ class MailHealthIndicatorTests { assertThat(health.getDetails()).containsEntry("location", "smtp.acme.org"); Object errorMessage = health.getDetails().get("error"); assertThat(errorMessage).isNotNull(); - assertThat(errorMessage.toString().contains("A test exception")).isTrue(); + assertThat(errorMessage.toString()).contains("A test exception"); } @Test diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 3a2a6ab1e79..38fe003d37f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -97,9 +97,9 @@ org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration org.springframework.boot.autoconfigure.pulsar.PulsarAutoConfiguration org.springframework.boot.autoconfigure.pulsar.PulsarReactiveAutoConfiguration org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration -org.springframework.boot.autoconfigure.reactor.ReactorAutoConfiguration org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration org.springframework.boot.autoconfigure.r2dbc.R2dbcTransactionManagerAutoConfiguration +org.springframework.boot.autoconfigure.reactor.ReactorAutoConfiguration org.springframework.boot.autoconfigure.rsocket.RSocketMessagingAutoConfiguration org.springframework.boot.autoconfigure.rsocket.RSocketRequesterAutoConfiguration org.springframework.boot.autoconfigure.rsocket.RSocketServerAutoConfiguration diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java index 0cade879b6e..3e8dcf01c8f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java @@ -304,7 +304,7 @@ class JacksonAutoConfigurationTests { @Test 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) -> { ObjectMapper mapper = context.getBean(ObjectMapper.class); assertThat(JsonNodeFeature.WRITE_NULL_PROPERTIES.enabledByDefault()).isTrue(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfigurationTests.java index 8e576929f2c..58275292597 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfigurationTests.java @@ -68,7 +68,7 @@ class RestTemplateAutoConfigurationTests { @Test void shouldFailOnCustomRestTemplateBuilderConfigurer() { - this.contextRunner.withUserConfiguration(RestTemplateCustomConfigurerConfig.class) + this.contextRunner.withUserConfiguration(RestTemplateBuilderConfigurerConfig.class) .run((context) -> assertThat(context).getFailure() .isInstanceOf(BeanDefinitionOverrideException.class) .hasMessageContaining("with name 'restTemplateBuilderConfigurer'")); @@ -273,7 +273,7 @@ class RestTemplateAutoConfigurationTests { } @Configuration(proxyBeanMethods = false) - static class RestTemplateCustomConfigurerConfig { + static class RestTemplateBuilderConfigurerConfig { @Bean RestTemplateBuilderConfigurer restTemplateBuilderConfigurer() { diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/docker-compose.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/docker-compose.adoc index 9b59fadc563..6d85a95109f 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/docker-compose.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/docker-compose.adoc @@ -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. 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. -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. diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/spring-mvc.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/spring-mvc.adoc index bebdf8562dc..1a137f05a2a 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/spring-mvc.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/spring-mvc.adoc @@ -75,7 +75,7 @@ These features are described in several enums (in Jackson) that map onto propert | `true`, `false` | `com.fasterxml.jackson.databind.cfg.JsonNodeFeature` -| `spring.jackson.datatype.jsonnode.` +| `spring.jackson.datatype.json-node.` | `true`, `false` | `com.fasterxml.jackson.databind.DeserializationFeature` diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/io/rest-client.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/io/rest-client.adoc index 1c980225069..6ec0da3ca53 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/io/rest-client.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/io/rest-client.adoc @@ -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. 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 <> instead of a `WebClient`. +TIP: If you are not writing a reactive Spring WebFlux application you can use the <> instead of a `WebClient`. 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. diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/web/reactive.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/web/reactive.adoc index 534c7df8b80..82292dbe64a 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/web/reactive.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/web/reactive.adoc @@ -271,7 +271,7 @@ Usually, you would define the properties in your `application.properties` or `ap 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. * <> * <> @@ -291,7 +291,7 @@ The following example shows programmatically setting the port: 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: include::code:MyNettyWebServerFactoryCustomizer[] diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/web/servlet.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/web/servlet.adoc index 6171b71ee32..538487db266 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/web/servlet.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/web/servlet.adoc @@ -575,7 +575,7 @@ Usually, you would define the properties in your `application.properties` or `ap 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.*`). * Error management: Location of the error page (`server.error.path`) and so on. * <> diff --git a/spring-boot-project/spring-boot-parent/build.gradle b/spring-boot-project/spring-boot-parent/build.gradle index 09564f5bfd5..4484d617520 100644 --- a/spring-boot-project/spring-boot-parent/build.gradle +++ b/spring-boot-project/spring-boot-parent/build.gradle @@ -30,7 +30,7 @@ bom { library("C3P0", "0.9.5.5") { group("com.mchange") { modules = [ - "c3p0" + "c3p0" ] } } @@ -141,7 +141,7 @@ bom { library("Micrometer Context Propagation", "1.0.5") { group("io.micrometer") { modules = [ - "context-propagation" + "context-propagation" ] } } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/SpringBootMockMvcBuilderCustomizerTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/SpringBootMockMvcBuilderCustomizerTests.java index 207be549873..87c5cee78d6 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/SpringBootMockMvcBuilderCustomizerTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/SpringBootMockMvcBuilderCustomizerTests.java @@ -210,9 +210,4 @@ class SpringBootMockMvcBuilderCustomizerTests { } - static record RegisteredFilter(Filter filter, Map initParameters, - EnumSet dispatcherTypes) { - - } - } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipContent.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipContent.java index 2130b0fc1e2..cc980b915b3 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipContent.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/zip/ZipContent.java @@ -40,8 +40,8 @@ import org.springframework.boot.loader.log.DebugLogger; * 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. *

- * In order to reduce memory consumption, this implementation stores only the the hash of - * the entry names, the central directory offsets and the original positions. Entries are + * In order to reduce memory consumption, this implementation stores only the hash of the + * 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 * quickly find an entry by name or determine if the zip file doesn't have a given entry. *

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 1cbd3426465..b542dc46496 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 @@ -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 * non-daemon threads * @since 3.2.0