diff --git a/framework-docs/modules/ROOT/pages/web/webflux/config.adoc b/framework-docs/modules/ROOT/pages/web/webflux/config.adoc index 144a65de46b..a74d18f2cac 100644 --- a/framework-docs/modules/ROOT/pages/web/webflux/config.adoc +++ b/framework-docs/modules/ROOT/pages/web/webflux/config.adoc @@ -742,7 +742,7 @@ reliance on it. [[webflux-config-blocking-execution]] == Blocking Execution -The WebFlux Java config lets you to customize blocking execution in WebFlux. +The WebFlux Java config allows you to customize blocking execution in WebFlux. You can have blocking controller methods called on a separate thread by providing an `Executor` such as the @@ -777,7 +777,7 @@ Kotlin:: @Override fun configureBlockingExecution(configurer: BlockingExecutionConfigurer) { - val executor = ... + val executor = ... configurer.setExecutor(executor) } } diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/support/SqlArrayValueTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/support/SqlArrayValueTests.java index 9207591dbfd..10fbebeb075 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/support/SqlArrayValueTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/support/SqlArrayValueTests.java @@ -33,7 +33,7 @@ import static org.mockito.BDDMockito.verify; * @author Philippe Marschall * @since 6.1 */ -public class SqlArrayValueTests { +class SqlArrayValueTests { private final Connection con = mock(); @@ -47,7 +47,7 @@ public class SqlArrayValueTests { @Test - public void setValue() throws SQLException { + void setValue() throws SQLException { given(this.ps.getConnection()).willReturn(this.con); given(this.con.createArrayOf("smallint", elements)).willReturn(this.arr); diff --git a/spring-tx/src/main/java/org/springframework/dao/support/DataAccessUtils.java b/spring-tx/src/main/java/org/springframework/dao/support/DataAccessUtils.java index 0fe38231848..fb6395c8eed 100644 --- a/spring-tx/src/main/java/org/springframework/dao/support/DataAccessUtils.java +++ b/spring-tx/src/main/java/org/springframework/dao/support/DataAccessUtils.java @@ -33,7 +33,8 @@ import org.springframework.util.NumberUtils; /** * Miscellaneous utility methods for DAO implementations. - * Useful with any data access technology. + * + *
Useful with any data access technology.
*
* @author Juergen Hoeller
* @since 1.0.2
@@ -80,7 +81,7 @@ public abstract class DataAccessUtils {
if (resultList.size() > 1) {
throw new IncorrectResultSizeDataAccessException(1);
}
- return CollectionUtils.isEmpty(resultList) ? null : resultList.get(0);
+ return resultList.isEmpty() ? null : resultList.get(0);
}
}
diff --git a/spring-tx/src/test/java/org/springframework/dao/annotation/PersistenceExceptionTranslationAdvisorTests.java b/spring-tx/src/test/java/org/springframework/dao/annotation/PersistenceExceptionTranslationAdvisorTests.java
index 876d5405eae..811cdcb7e26 100644
--- a/spring-tx/src/test/java/org/springframework/dao/annotation/PersistenceExceptionTranslationAdvisorTests.java
+++ b/spring-tx/src/test/java/org/springframework/dao/annotation/PersistenceExceptionTranslationAdvisorTests.java
@@ -27,7 +27,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.InvalidDataAccessApiUsageException;
-import org.springframework.dao.support.DataAccessUtilsTests.MapPersistenceExceptionTranslator;
+import org.springframework.dao.support.MapPersistenceExceptionTranslator;
import org.springframework.dao.support.PersistenceExceptionTranslator;
import org.springframework.stereotype.Repository;
diff --git a/spring-tx/src/test/java/org/springframework/dao/support/ChainedPersistenceExceptionTranslatorTests.java b/spring-tx/src/test/java/org/springframework/dao/support/ChainedPersistenceExceptionTranslatorTests.java
index a4d5e24ae93..6a4e1e837cb 100644
--- a/spring-tx/src/test/java/org/springframework/dao/support/ChainedPersistenceExceptionTranslatorTests.java
+++ b/spring-tx/src/test/java/org/springframework/dao/support/ChainedPersistenceExceptionTranslatorTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2019 the original author or authors.
+ * Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test;
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.dao.OptimisticLockingFailureException;
-import org.springframework.dao.support.DataAccessUtilsTests.MapPersistenceExceptionTranslator;
import static org.assertj.core.api.Assertions.assertThat;
@@ -28,18 +27,17 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Rod Johnson
* @since 2.0
*/
-public class ChainedPersistenceExceptionTranslatorTests {
+class ChainedPersistenceExceptionTranslatorTests {
@Test
- public void empty() {
+ void empty() {
ChainedPersistenceExceptionTranslator pet = new ChainedPersistenceExceptionTranslator();
- //MapPersistenceExceptionTranslator mpet = new MapPersistenceExceptionTranslator();
RuntimeException in = new RuntimeException("in");
assertThat(DataAccessUtils.translateIfNecessary(in, pet)).isSameAs(in);
}
@Test
- public void exceptionTranslationWithTranslation() {
+ void exceptionTranslationWithTranslation() {
MapPersistenceExceptionTranslator mpet1 = new MapPersistenceExceptionTranslator();
RuntimeException in1 = new RuntimeException("in");
InvalidDataAccessApiUsageException out1 = new InvalidDataAccessApiUsageException("out");
diff --git a/spring-tx/src/test/java/org/springframework/dao/support/DataAccessUtilsTests.java b/spring-tx/src/test/java/org/springframework/dao/support/DataAccessUtilsTests.java
index 59b1dde4f49..f80e92df139 100644
--- a/spring-tx/src/test/java/org/springframework/dao/support/DataAccessUtilsTests.java
+++ b/spring-tx/src/test/java/org/springframework/dao/support/DataAccessUtilsTests.java
@@ -20,15 +20,12 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.Map;
import java.util.Optional;
import java.util.function.Consumer;
import org.junit.jupiter.api.Test;
-import org.springframework.dao.DataAccessException;
import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.dao.TypeMismatchDataAccessException;
@@ -40,10 +37,10 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Juergen Hoeller
* @since 20.10.2004
*/
-public class DataAccessUtilsTests {
+class DataAccessUtilsTests {
@Test
- public void withEmptyCollection() {
+ void withEmptyCollection() {
Collection Note:There are security considerations surrounding the use
+ * Note: There are security considerations surrounding the use
* of forwarded headers. Those should not be used unless the application is
* behind a trusted proxy that inserts them and also explicitly removes any such
* headers coming from an external source.
*
- * In most cases, should not use this class directly but rely on
- * {@link org.springframework.web.filter.ForwardedHeaderFilter} for Spring MVC, or
+ * In most cases, you should not use this class directly but rather rely on
+ * {@link org.springframework.web.filter.ForwardedHeaderFilter} for Spring MVC or
* {@link org.springframework.web.server.adapter.ForwardedHeaderTransformer} in
- * order to extract the information from them as early as possible, and discard
- * such headers. Underlying servers such as Tomcat, Jetty, Reactor Netty, also
- * provides options to handle forwarded headers even earlier.
+ * order to extract the information from the headers as early as possible and discard
+ * such headers. Underlying servers such as Tomcat, Jetty, and Reactor Netty also
+ * provide options to handle forwarded headers even earlier.
*
* @author Rossen Stoyanchev
* @since 6.1
@@ -56,10 +55,11 @@ public abstract class ForwardedHeaderUtils {
/**
- * Adapt the scheme+host+port of the given {@link URI} from the "Forwarded" header,
- * see RFC 7239, or
- * "X-Forwarded-Host", "X-Forwarded-Port", and "X-Forwarded-Proto" if "Forwarded"
- * is not present.
+ * Adapt the scheme+host+port of the given {@link URI} from the "Forwarded" header
+ * (see RFC 7239) or from the
+ * "X-Forwarded-Host", "X-Forwarded-Port", and "X-Forwarded-Proto" headers if
+ * "Forwarded" is not present.
+ * @param uri the request {@code URI}
* @param headers the HTTP headers to consider
* @return a {@link UriComponentsBuilder} that reflects the request URI and
* additional updates from forwarded headers
@@ -106,7 +106,7 @@ public abstract class ForwardedHeaderUtils {
catch (NumberFormatException ex) {
throw new IllegalArgumentException("Failed to parse a port from \"forwarded\"-type headers. " +
"If not behind a trusted proxy, consider using ForwardedHeaderFilter " +
- "with the removeOnly=true. Request headers: " + headers);
+ "with removeOnly=true. Request headers: " + headers);
}
uriComponentsBuilder.resetPortIfDefaultForScheme();
@@ -138,11 +138,11 @@ public abstract class ForwardedHeaderUtils {
/**
* Parse the first "Forwarded: for=..." or "X-Forwarded-For" header value to
* an {@code InetSocketAddress} representing the address of the client.
- * @param uri the request URI
+ * @param uri the request {@code URI}
* @param headers the request headers that may contain forwarded headers
- * @param remoteAddress the current remoteAddress
+ * @param remoteAddress the current remote address
* @return an {@code InetSocketAddress} with the extracted host and port, or
- * {@code null} if the headers are not present.
+ * {@code null} if the headers are not present
* @see RFC 7239, Section 5.2
*/
@Nullable
diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/config/BlockingExecutionConfigurer.java b/spring-webflux/src/main/java/org/springframework/web/reactive/config/BlockingExecutionConfigurer.java
index c04cfec6cc4..ca56c995493 100644
--- a/spring-webflux/src/main/java/org/springframework/web/reactive/config/BlockingExecutionConfigurer.java
+++ b/spring-webflux/src/main/java/org/springframework/web/reactive/config/BlockingExecutionConfigurer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2022 the original author or authors.
+ * Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,7 +51,7 @@ public class BlockingExecutionConfigurer {
/**
* Configure a predicate to decide if a controller method is blocking and
* should be called on a separate thread if an executor is
- * {@link #setExecutor configured}.
+ * {@linkplain #setExecutor configured}.
* The default predicate matches controller methods whose return type is
* not recognized by the configured
* {@link org.springframework.core.ReactiveAdapterRegistry}.
diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerAdapter.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerAdapter.java
index 6a1130c09c4..d94c32aeaeb 100644
--- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerAdapter.java
+++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerAdapter.java
@@ -151,7 +151,7 @@ public class RequestMappingHandlerAdapter
* Provide a predicate to decide which controller methods to invoke through
* the configured {@link #setBlockingExecutor blockingExecutor}.
* If an executor is configured, the default predicate matches controller
- * methods whose return type not recognized by the configured
+ * methods whose return type is not recognized by the configured
* {@link org.springframework.core.ReactiveAdapterRegistry}.
* @param predicate the predicate to use
* @since 6.1