From 0a54804a0f9ef64aaf6004a72efe43a79247a52c Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Sat, 17 May 2025 20:56:57 +0900 Subject: [PATCH] Polish See gh-45592 Signed-off-by: Johnny Lim --- .../antora/modules/api/pages/rest/actuator/metrics.adoc | 2 +- .../autoconfigure/jersey/JerseyAutoConfigurationTests.java | 3 +-- .../boot/docker/compose/core/DockerCliInspectResponse.java | 2 +- .../boot/docker/compose/core/DockerComposeFileTests.java | 2 +- .../modules/reference/pages/features/external-config.adoc | 6 +++--- .../native-image/introducing-graalvm-native-images.adoc | 2 +- .../test/context/ImportsContextCustomizerFactoryTests.java | 4 ++-- .../testcontainers/service/connection/FieldOriginTests.java | 2 +- .../boot/loader/nio/file/NestedFileSystemTests.java | 2 +- .../boot/loader/nio/file/NestedPathTests.java | 2 +- .../context/config/StandardConfigDataResourceTests.java | 2 +- .../org/springframework/boot/ssl/pem/PemContentTests.java | 2 +- .../bind/KotlinDefaultBindConstructorProviderTests.kt | 2 +- .../src/dockerTest/resources/ssl/cassandra.yaml | 2 +- 14 files changed, 17 insertions(+), 18 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/metrics.adoc b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/metrics.adoc index 9c5fcc8922..eec0cfc078 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/metrics.adoc +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/metrics.adoc @@ -3,7 +3,7 @@ The `metrics` endpoint provides access to application metrics to diagnose the metrics the application has recorded. This endpoint should not be "scraped" or used as a metrics backend in production. -Its purpose is to show the currently registered metrics so users can see what metrics are available, what their current values are, and if triggering certain operations cause any change in certain values. +Its purpose is to show the currently registered metrics so users can see what metrics are available, what their current values are, and if triggering certain operations causes any change in certain values. If you want to diagnose your applications through the metrics they collect, you should use an xref:reference:actuator/metrics.adoc[external metrics backend]. In this case, the `metrics` endpoint can still be useful. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationTests.java index add8e9d7e1..aee711f00a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationTests.java @@ -113,11 +113,10 @@ class JerseyAutoConfigurationTests { .stream() .filter(JakartaXmlBindAnnotationIntrospector.class::isInstance)).isEmpty(); }); - } @Test - void webApplicationIntializerDisablesJerseysWebApplicationInitializer() throws ServletException { + void webApplicationInitializerDisablesJerseyWebApplicationInitializer() throws ServletException { ServletContext context = new MockServletContext(); new JerseyWebApplicationInitializer().onStartup(context); assertThat(context.getInitParameter("contextConfigLocation")).isEqualTo(""); diff --git a/spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/core/DockerCliInspectResponse.java b/spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/core/DockerCliInspectResponse.java index 3c3b7d2c75..2f2f063251 100644 --- a/spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/core/DockerCliInspectResponse.java +++ b/spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/core/DockerCliInspectResponse.java @@ -53,7 +53,7 @@ record DockerCliInspectResponse(String id, DockerCliInspectResponse.Config confi } /** - * A container's resources (cgroups config, ulimits, etc). + * A container's resources (cgroups config, ulimits, etc.). * * @param networkMode the network mode to use for this container */ diff --git a/spring-boot-project/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/core/DockerComposeFileTests.java b/spring-boot-project/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/core/DockerComposeFileTests.java index 02bab15eb4..95cb804647 100644 --- a/spring-boot-project/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/core/DockerComposeFileTests.java +++ b/spring-boot-project/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/core/DockerComposeFileTests.java @@ -49,7 +49,7 @@ class DockerComposeFileTests { DockerComposeFile c2 = DockerComposeFile.of(f1); DockerComposeFile c3 = DockerComposeFile.find(f1.getParentFile()); DockerComposeFile c4 = DockerComposeFile.of(f2); - assertThat(c1.hashCode()).isEqualTo(c2.hashCode()).isEqualTo(c3.hashCode()); + assertThat(c1).hasSameHashCodeAs(c2).hasSameHashCodeAs(c3); assertThat(c1).isEqualTo(c1).isEqualTo(c2).isEqualTo(c3).isNotEqualTo(c4); } diff --git a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/external-config.adoc b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/external-config.adoc index c2d30dcfe1..d4138c6ba7 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/external-config.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/external-config.adoc @@ -305,7 +305,7 @@ Imports may be specified as _fixed_ or _import relative_ locations. A fixed location always resolves to the same underlying resource, regardless of where the configprop:spring.config.import[] property is declared. An import relative location resolves relative to the file that declares the configprop:spring.config.import[] property. -A location starting with a forward slash (`/`) or a URL style prefix (`file:`, `classpath:`, etc) is considered fixed. +A location starting with a forward slash (`/`) or a URL style prefix (`file:`, `classpath:`, etc.) is considered fixed. All other locations are considered import relative. NOTE: `optional:` prefixes are not considered when determining if a location is fixed or import relative. @@ -313,7 +313,7 @@ NOTE: `optional:` prefixes are not considered when determining if a location is As an example, say we have a `/demo` directory containing our `application.jar` file. We might add a `/demo/application.properties` file with the following content: -[,properties] +[source,properties] ---- spring.config.import=optional:core/core.properties ---- @@ -322,7 +322,7 @@ This is an import relative location and so will attempt to load the file `/demo/ If `/demo/core/core.properties` has the following content: -[,properties] +[source,properties] ---- spring.config.import=optional:extra/extra.properties ---- diff --git a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/native-image/introducing-graalvm-native-images.adoc b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/native-image/introducing-graalvm-native-images.adoc index ff0fb3a0a8..62c5d5a1a0 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/native-image/introducing-graalvm-native-images.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/native-image/introducing-graalvm-native-images.adoc @@ -55,7 +55,7 @@ When these restrictions are in place, it becomes possible for Spring to perform A Spring AOT processed application will typically generate: * Java source code -* Bytecode (for dynamic proxies etc) +* Bytecode (for dynamic proxies, etc.) * GraalVM JSON hint files in `+META-INF/native-image/{groupId}/{artifactId}/+`: - Resource hints (`resource-config.json`) - Reflection hints (`reflect-config.json`) diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerFactoryTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerFactoryTests.java index 46ef48e1cf..d5ab82dcc3 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerFactoryTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerFactoryTests.java @@ -83,10 +83,10 @@ class ImportsContextCustomizerFactoryTests { .createContextCustomizer(TestWithImportAndComponentScanOfSomePackage.class, null); ContextCustomizer customizer3 = this.factory .createContextCustomizer(TestWithImportAndComponentScanOfAnotherPackage.class, null); - assertThat(customizer1.hashCode()).isEqualTo(customizer2.hashCode()); assertThat(customizer1).isEqualTo(customizer2); - assertThat(customizer3.hashCode()).isNotEqualTo(customizer2.hashCode()).isNotEqualTo(customizer1.hashCode()); + assertThat(customizer1).hasSameHashCodeAs(customizer2); assertThat(customizer3).isNotEqualTo(customizer2).isNotEqualTo(customizer1); + assertThat(customizer3).doesNotHaveSameHashCodeAs(customizer2).doesNotHaveSameHashCodeAs(customizer1); } @Test diff --git a/spring-boot-project/spring-boot-testcontainers/src/test/java/org/springframework/boot/testcontainers/service/connection/FieldOriginTests.java b/spring-boot-project/spring-boot-testcontainers/src/test/java/org/springframework/boot/testcontainers/service/connection/FieldOriginTests.java index d3b89a8d61..b08924c9ac 100644 --- a/spring-boot-project/spring-boot-testcontainers/src/test/java/org/springframework/boot/testcontainers/service/connection/FieldOriginTests.java +++ b/spring-boot-project/spring-boot-testcontainers/src/test/java/org/springframework/boot/testcontainers/service/connection/FieldOriginTests.java @@ -45,7 +45,7 @@ class FieldOriginTests { Origin o2 = new FieldOrigin(ReflectionUtils.findField(Fields.class, "one")); Origin o3 = new FieldOrigin(ReflectionUtils.findField(Fields.class, "two")); assertThat(o1).isEqualTo(o1).isEqualTo(o2).isNotEqualTo(o3); - assertThat(o1.hashCode()).isEqualTo(o2.hashCode()); + assertThat(o1).hasSameHashCodeAs(o2); } @Test diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/nio/file/NestedFileSystemTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/nio/file/NestedFileSystemTests.java index a65c534c56..d265925c45 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/nio/file/NestedFileSystemTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/nio/file/NestedFileSystemTests.java @@ -184,8 +184,8 @@ class NestedFileSystemTests { NestedFileSystem f2 = new NestedFileSystem(this.provider, jp1); NestedFileSystem f3 = new NestedFileSystem(this.provider, jp2); NestedFileSystem f4 = new NestedFileSystem(this.provider, jp3); - assertThat(f1.hashCode()).isEqualTo(f2.hashCode()); assertThat(f1).isEqualTo(f1).isEqualTo(f2).isEqualTo(f3).isNotEqualTo(f4); + assertThat(f1).hasSameHashCodeAs(f2); } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/nio/file/NestedPathTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/nio/file/NestedPathTests.java index 22953d0b09..d8299253fe 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/nio/file/NestedPathTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/nio/file/NestedPathTests.java @@ -208,7 +208,7 @@ class NestedPathTests { NestedPath p2 = new NestedPath(this.fileSystem, "a.jar"); NestedPath p3 = new NestedPath(this.fileSystem, "c.jar"); NestedPath p4 = new NestedPath(fs2, "c.jar"); - assertThat(p1.hashCode()).isEqualTo(p2.hashCode()); + assertThat(p1).hasSameHashCodeAs(p2); assertThat(p1).isEqualTo(p1).isEqualTo(p2).isNotEqualTo(p3).isNotEqualTo(p4); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataResourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataResourceTests.java index 35ceda8c21..af593dd40d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataResourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataResourceTests.java @@ -87,8 +87,8 @@ class StandardConfigDataResourceTests { FileUrlResource fileResource = new FileUrlResource(classResource.getURL()); ConfigDataResource classDataResource = new StandardConfigDataResource(this.reference, classResource); ConfigDataResource fileDataResource = new StandardConfigDataResource(this.reference, fileResource); - assertThat(classDataResource.hashCode()).isEqualTo(fileDataResource.hashCode()); assertThat(classDataResource).isEqualTo(fileDataResource); + assertThat(classDataResource).hasSameHashCodeAs(fileDataResource); } finally { Thread.currentThread().setContextClassLoader(contextClassLoader); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemContentTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemContentTests.java index 147148d120..0dfe86536f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemContentTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemContentTests.java @@ -86,8 +86,8 @@ class PemContentTests { PemContent c1 = PemContent.of("aaa"); PemContent c2 = PemContent.of("aaa"); PemContent c3 = PemContent.of("bbb"); - assertThat(c1.hashCode()).isEqualTo(c2.hashCode()); assertThat(c1).isEqualTo(c1).isEqualTo(c2).isNotEqualTo(c3); + assertThat(c1).hasSameHashCodeAs(c2); } @Test diff --git a/spring-boot-project/spring-boot/src/test/kotlin/org/springframework/boot/context/properties/bind/KotlinDefaultBindConstructorProviderTests.kt b/spring-boot-project/spring-boot/src/test/kotlin/org/springframework/boot/context/properties/bind/KotlinDefaultBindConstructorProviderTests.kt index be13746f7f..f772456c49 100644 --- a/spring-boot-project/spring-boot/src/test/kotlin/org/springframework/boot/context/properties/bind/KotlinDefaultBindConstructorProviderTests.kt +++ b/spring-boot-project/spring-boot/src/test/kotlin/org/springframework/boot/context/properties/bind/KotlinDefaultBindConstructorProviderTests.kt @@ -62,7 +62,7 @@ class KotlinDefaultBindConstructorProviderTests { } @Test - fun `type with no param primary constructor and secondary params constructor should not use constructor binding`() { + fun `type with no param primary constructor and params secondary constructor should not use constructor binding`() { val bindConstructor = this.constructorProvider.getBindConstructor(NoParamPrimaryWithParamsSecondaryProperties::class.java, false) assertThat(bindConstructor).isNull() } diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-cassandra/src/dockerTest/resources/ssl/cassandra.yaml b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-cassandra/src/dockerTest/resources/ssl/cassandra.yaml index 8a34709e77..6c755ec110 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-cassandra/src/dockerTest/resources/ssl/cassandra.yaml +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-cassandra/src/dockerTest/resources/ssl/cassandra.yaml @@ -604,7 +604,7 @@ ssl_storage_port: 7001 # # Leaving it blank leaves it up to InetAddress.getLocalHost(). This # will always do the Right Thing _if_ the node is properly configured -# (hostname, name resolution, etc), and the Right Thing is to use the +# (hostname, name resolution, etc.), and the Right Thing is to use the # address associated with the hostname (it might not be). # # Setting listen_address to 0.0.0.0 is always wrong.