From d0331a049a45c4bd32498b1392bb8547e4c1aca0 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 22 Jun 2026 21:52:57 +0200 Subject: [PATCH] Refine various javadoc notes --- .../main/java/org/springframework/beans/BeanWrapper.java | 2 +- .../java/org/springframework/validation/DataBinder.java | 8 +++++--- .../core/io/support/LocalizedResourceHelper.java | 6 +++--- .../java/org/springframework/util/FileSystemUtils.java | 2 +- .../messaging/core/CachingDestinationResolverProxy.java | 3 +++ .../bind/support/ConfigurableWebBindingInitializer.java | 2 ++ .../web/servlet/mvc/ParameterizableViewController.java | 7 ++++--- 7 files changed, 19 insertions(+), 11 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/BeanWrapper.java b/spring-beans/src/main/java/org/springframework/beans/BeanWrapper.java index 799479313a5..ffd6a5a672c 100644 --- a/spring-beans/src/main/java/org/springframework/beans/BeanWrapper.java +++ b/spring-beans/src/main/java/org/springframework/beans/BeanWrapper.java @@ -49,7 +49,7 @@ import java.beans.PropertyDescriptor; public interface BeanWrapper extends ConfigurablePropertyAccessor { /** - * Specify a limit for array and collection auto-growing. + * Specify a limit for array and collection/set/list auto-growing. *

Default is unlimited on a plain BeanWrapper. * @since 4.1 */ diff --git a/spring-context/src/main/java/org/springframework/validation/DataBinder.java b/spring-context/src/main/java/org/springframework/validation/DataBinder.java index 2653c2b1dfc..7559a7d2ea6 100644 --- a/spring-context/src/main/java/org/springframework/validation/DataBinder.java +++ b/spring-context/src/main/java/org/springframework/validation/DataBinder.java @@ -270,12 +270,12 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter { } /** - * Specify the limit for array and collection auto-growing. + * Specify the limit for array and collection/set/list auto-growing. *

Default is 256, preventing OutOfMemoryErrors in case of large indexes. * Raise this limit if your auto-growing needs are unusually high. *

Used for setter injection via {@link #bind(PropertyValues)}; - * not applicable to field injection, and not to constructor binding - * via {@link #construct} either. + * not applicable to map properties and not to field injection and + * constructor binding via {@link #construct} either. * @see #initBeanPropertyAccess() * @see org.springframework.beans.BeanWrapper#setAutoGrowCollectionLimit */ @@ -326,6 +326,8 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter { /** * Initialize direct field access for this DataBinder, * as alternative to the default bean property access. + *

NOTE: This is an advanced option for trusted scenarios. + * Do not use direct field access for data binding from untrusted sources. * @see #initBeanPropertyAccess() * @see #createDirectFieldBindingResult() */ diff --git a/spring-core/src/main/java/org/springframework/core/io/support/LocalizedResourceHelper.java b/spring-core/src/main/java/org/springframework/core/io/support/LocalizedResourceHelper.java index f2ee2398c1c..fe343e51474 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/LocalizedResourceHelper.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/LocalizedResourceHelper.java @@ -100,20 +100,20 @@ public class LocalizedResourceHelper { String variant = locale.getVariant(); // Check for file with language, country and variant localization. - if (variant.length() > 0) { + if (!variant.isEmpty()) { String location = name + this.separator + lang + this.separator + country + this.separator + variant + extension; resource = this.resourceLoader.getResource(location); } // Check for file with language and country localization. - if ((resource == null || !resource.exists()) && country.length() > 0) { + if ((resource == null || !resource.exists()) && !country.isEmpty()) { String location = name + this.separator + lang + this.separator + country + extension; resource = this.resourceLoader.getResource(location); } // Check for document with language localization. - if ((resource == null || !resource.exists()) && lang.length() > 0) { + if ((resource == null || !resource.exists()) && !lang.isEmpty()) { String location = name + this.separator + lang + extension; resource = this.resourceLoader.getResource(location); } diff --git a/spring-core/src/main/java/org/springframework/util/FileSystemUtils.java b/spring-core/src/main/java/org/springframework/util/FileSystemUtils.java index 0f5f8d6b16f..d0f7f293853 100644 --- a/spring-core/src/main/java/org/springframework/util/FileSystemUtils.java +++ b/spring-core/src/main/java/org/springframework/util/FileSystemUtils.java @@ -118,7 +118,7 @@ public abstract class FileSystemUtils { /** * Recursively copy the contents of the {@code src} file/directory - * to the {@code dest} file/directory. + * to the {@code dest} file/directory, including symbolic links. * @param src the source directory * @param dest the destination directory * @throws IOException in the case of I/O errors diff --git a/spring-messaging/src/main/java/org/springframework/messaging/core/CachingDestinationResolverProxy.java b/spring-messaging/src/main/java/org/springframework/messaging/core/CachingDestinationResolverProxy.java index 05346ec2be3..e7f8788c165 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/core/CachingDestinationResolverProxy.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/core/CachingDestinationResolverProxy.java @@ -30,6 +30,9 @@ import org.springframework.util.Assert; * if the destination resolving process is expensive (for example, the destination has to be * resolved through an external system) and the resolution results are stable anyway. * + *

Note: This cache is not designed for setups with varying dynamic destination names. + * Prefer direct destination resolution in such scenarios. + * * @author Agim Emruli * @author Juergen Hoeller * @since 4.1 diff --git a/spring-web/src/main/java/org/springframework/web/bind/support/ConfigurableWebBindingInitializer.java b/spring-web/src/main/java/org/springframework/web/bind/support/ConfigurableWebBindingInitializer.java index ea6f7521698..d9d833a49cd 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/support/ConfigurableWebBindingInitializer.java +++ b/spring-web/src/main/java/org/springframework/web/bind/support/ConfigurableWebBindingInitializer.java @@ -83,6 +83,8 @@ public class ConfigurableWebBindingInitializer implements WebBindingInitializer * Set whether to use direct field access instead of bean property access. *

Default is {@code false}, using bean property access. * Switch this to {@code true} in order to enforce direct field access. + *

NOTE: This is an advanced option for trusted scenarios. + * Do not use direct field access for data binding from untrusted sources. * @see org.springframework.validation.DataBinder#initDirectFieldAccess() * @see org.springframework.validation.DataBinder#initBeanPropertyAccess() */ diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/ParameterizableViewController.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/ParameterizableViewController.java index 1212e7eb1a4..d124c7276f1 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/ParameterizableViewController.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/ParameterizableViewController.java @@ -51,6 +51,7 @@ public class ParameterizableViewController extends AbstractController { setSupportedMethods(HttpMethod.GET.name(), HttpMethod.HEAD.name()); } + /** * Set a view name for the ModelAndView to return, to be resolved by the * DispatcherServlet via a ViewResolver. Will override any pre-existing @@ -117,12 +118,11 @@ public class ParameterizableViewController extends AbstractController { return this.statusCode; } - /** * The property can be used to indicate the request is considered fully * handled within the controller and that no view should be used for rendering. * Useful in combination with {@link #setStatusCode}. - *

By default this is set to {@code false}. + *

By default, this is set to {@code false}. * @since 4.1 */ public void setStatusOnly(boolean statusOnly) { @@ -187,10 +187,11 @@ public class ParameterizableViewController extends AbstractController { sb.append("status=").append(this.statusCode); } if (this.view != null) { - sb.append(sb.length() != 0 ? ", " : ""); + sb.append(!sb.isEmpty() ? ", " : ""); String viewName = getViewName(); sb.append("view=").append(viewName != null ? "\"" + viewName + "\"" : this.view); } return sb.toString(); } + }