From 9497cdf02e02e4a340fbe78a0fef8f517d709ac6 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Fri, 7 Feb 2025 00:15:25 +0900 Subject: [PATCH] Polish Signed-off-by: Johnny Lim --- .../antora/modules/api/pages/rest/actuator/quartz.adoc | 2 +- .../additional-spring-configuration-metadata.json | 4 ++-- .../boot/actuate/quartz/QuartzEndpoint.java | 4 +++- .../actuate/quartz/QuartzEndpointWebExtension.java | 10 ++++++++++ .../boot/actuate/quartz/QuartzEndpointTests.java | 2 +- .../condition/ConditionalOnBooleanProperties.java | 2 +- .../autoconfigure/condition/OnPropertyCondition.java | 4 ++-- .../additional-spring-configuration-metadata.json | 4 ++-- .../r2dbc/R2dbcAutoConfigurationTests.java | 9 ++++----- .../modules/reference/pages/features/logging.adoc | 2 +- .../boot/ssl/FixedTrustManagerFactoryTests.java | 2 +- 11 files changed, 28 insertions(+), 17 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/quartz.adoc b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/quartz.adoc index 3e1975933841..8b1bb4976d6c 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/quartz.adoc +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/quartz.adoc @@ -176,7 +176,7 @@ include::partial$rest/actuator/quartz/trigger-job/http-response.adoc[] === Request Structure The request specifies a desired `state` associated with a particular job. -Sending an HTTP Request with a `"state": "running"` body indicates that the job should be run now. +Sending an HTTP request with a `"state": "running"` body indicates that the job should be run now. The following table describes the structure of the request: [cols="2,1,3"] diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 1e95b92bbbed..98fb9552ce3e 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -64,7 +64,7 @@ }, { "name": "management.endpoints.access.max-permitted", - "description": "The maximum level of endpoint access that is permitted. Caps an endpoint's individual access level (management.endpoint..access) and the default access (management.endpoints.access.default).'", + "description": "Maximum level of endpoint access that is permitted. Caps an endpoint's individual access level (management.endpoint..access) and the default access (management.endpoints.access.default).'", "defaultValue": "unrestricted" }, { @@ -2107,7 +2107,7 @@ }, { "name": "management.server.ssl.bundle", - "description": "The name of a configured SSL bundle." + "description": "Name of a configured SSL bundle." }, { "name": "management.server.ssl.certificate", diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/quartz/QuartzEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/quartz/QuartzEndpoint.java index 49608ac6b0d8..67b906dcb010 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/quartz/QuartzEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/quartz/QuartzEndpoint.java @@ -409,7 +409,9 @@ public String getClassName() { } /** - * Description of a triggered on demand {@link Job Quartz Job}. + * Description of a triggered on-demand {@link Job Quartz Job}. + * + * @since 3.5.0 */ public static final class QuartzJobTriggerDescriptor { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/quartz/QuartzEndpointWebExtension.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/quartz/QuartzEndpointWebExtension.java index c36f7c1ba16f..118837adf78a 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/quartz/QuartzEndpointWebExtension.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/quartz/QuartzEndpointWebExtension.java @@ -80,6 +80,16 @@ public WebEndpointResponse quartzJobOrTrigger(SecurityContext securityCo () -> this.delegate.quartzTrigger(group, name, showUnsanitized)); } + /** + * Trigger a Quartz job. + * @param jobs path segment "jobs" + * @param group job's group + * @param name job name + * @param state desired state + * @return web endpoint response + * @throws SchedulerException if there is an error triggering the job + * @since 3.5.0 + */ @WriteOperation public WebEndpointResponse triggerQuartzJob(@Selector String jobs, @Selector String group, @Selector String name, String state) throws SchedulerException { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/quartz/QuartzEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/quartz/QuartzEndpointTests.java index ccaca16e1ce2..f99f45cd48e5 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/quartz/QuartzEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/quartz/QuartzEndpointTests.java @@ -778,7 +778,7 @@ void quartzJobShouldBeTriggered() throws SchedulerException { } @Test - void quartzJobShouldNotBeTriggeredJobDoesNotExist() throws SchedulerException { + void quartzJobShouldNotBeTriggeredWhenJobDoesNotExist() throws SchedulerException { QuartzJobTriggerDescriptor quartzJobTriggerDescriptor = this.endpoint.triggerQuartzJob("samples", "hello"); assertThat(quartzJobTriggerDescriptor).isNull(); then(this.scheduler).should(never()).triggerJob(any()); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBooleanProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBooleanProperties.java index b44eeea7d37e..7bc923fc21e1 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBooleanProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBooleanProperties.java @@ -26,7 +26,7 @@ /** * Container annotation that aggregates several - * {@link ConditionalOnProperty @ConditionalOnProperty} annotations. + * {@link ConditionalOnBooleanProperty @ConditionalOnBooleanProperty} annotations. * * @author Phillip Webb * @since 3.5.0 diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java index 694e6e9e6b2f..c502fa9d0b38 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java @@ -89,8 +89,8 @@ private Stream> streamRepeated(MergedAnnotation> stream(MergedAnnotations annotations, - Class containerType) { - return annotations.stream(containerType.getName()) + Class type) { + return annotations.stream(type.getName()) .filter(MergedAnnotationPredicates.unique(MergedAnnotation::getMetaTypes)); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 3a26383f2b03..9d9dd4b2081a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -269,7 +269,7 @@ }, { "name": "server.ssl.bundle", - "description": "The name of a configured SSL bundle." + "description": "Name of a configured SSL bundle." }, { "name": "server.ssl.certificate", @@ -2606,7 +2606,7 @@ }, { "name": "spring.rsocket.server.ssl.bundle", - "description": "The name of a configured SSL bundle." + "description": "Name of a configured SSL bundle." }, { "name": "spring.rsocket.server.ssl.certificate", diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/r2dbc/R2dbcAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/r2dbc/R2dbcAutoConfigurationTests.java index 926b56bccc5f..6c3b12308379 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/r2dbc/R2dbcAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/r2dbc/R2dbcAutoConfigurationTests.java @@ -35,7 +35,6 @@ import org.assertj.core.api.InstanceOfAssertFactory; import org.assertj.core.api.ObjectAssert; import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; import org.springframework.beans.factory.BeanCreationException; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -48,7 +47,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.r2dbc.core.DatabaseClient; -import org.springframework.test.util.ReflectionTestUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -98,9 +96,10 @@ void configureWithUrlAndPoolPropertiesApplyProperties() { assertThat(poolMetrics.getMaxAllocatedSize()).isEqualTo(15); assertThat(connectionPool).hasFieldOrPropertyWithValue("maxAcquireTime", Duration.ofMinutes(3)); assertThat(connectionPool).hasFieldOrPropertyWithValue("maxValidationTime", Duration.ofSeconds(1)); - Mono create = (Mono) ReflectionTestUtils.getField(connectionPool, "create"); - assertThat(create.getClass().getName()).endsWith("MonoRetry"); - assertThat(create).hasFieldOrPropertyWithValue("times", 5L); + assertThat(connectionPool).extracting("create").satisfies((mono) -> { + assertThat(mono.getClass().getName()).endsWith("MonoRetry"); + assertThat(mono).hasFieldOrPropertyWithValue("times", 5L); + }); } finally { connectionPool.close().block(); diff --git a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/logging.adoc b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/logging.adoc index 1e0792d5cf4e..f2aa01cba628 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/logging.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/logging.adoc @@ -642,7 +642,7 @@ logging: ---- TIP: For more advanced customizations, you can use the javadoc:org.springframework.boot.logging.structured.StructuredLoggingJsonMembersCustomizer[] interface. -You can reference a one or more implementations using the configprop:logging.structured.json.customizer[] property. +You can reference one or more implementations using the configprop:logging.structured.json.customizer[] property. You can also declare implementations by listing them in a `META-INF/spring.factories` file. diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/FixedTrustManagerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/FixedTrustManagerFactoryTests.java index ec16487b0eb5..e6dfe07ce00a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/FixedTrustManagerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/FixedTrustManagerFactoryTests.java @@ -34,7 +34,7 @@ class FixedTrustManagerFactoryTests { @Test - void shouldReturnTrustmanagers() throws Exception { + void shouldReturnTrustManagers() throws Exception { TrustManager trustManager1 = mock(TrustManager.class); TrustManager trustManager2 = mock(TrustManager.class); FixedTrustManagerFactory factory = FixedTrustManagerFactory.of(getDefaultTrustManagerFactory(), trustManager1,