Merge branch '6.2.x'

This commit is contained in:
Sam Brannen
2025-01-18 17:03:31 +01:00
5 changed files with 55 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2025 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.
@@ -26,8 +26,7 @@ import org.springframework.util.StringUtils;
/**
* Abstract base class for {@link PropertySource} implementations backed by command line
* arguments. The parameterized type {@code T} represents the underlying source of command
* line options. For instance, {@link SimpleCommandLinePropertySource} uses a String
* array.
* line options.
*
* <h3>Purpose and General Usage</h3>
*
@@ -260,10 +259,11 @@ public abstract class CommandLinePropertySource<T> extends EnumerablePropertySou
* This implementation first checks to see if the name specified is the special
* {@linkplain #setNonOptionArgsPropertyName(String) "non-option arguments" property},
* and if so delegates to the abstract {@link #getNonOptionArgs()} method. If so
* and the collection of non-option arguments is empty, this method returns {@code
* null}. If not empty, it returns a comma-separated String of all non-option
* arguments. Otherwise, delegates to and returns the result of the abstract {@link
* #getOptionValues(String)} method.
* and the collection of non-option arguments is empty, this method returns
* {@code null}. If not empty, it returns a comma-separated String of all non-option
* arguments. Otherwise, this method delegates to and returns a comma-separated String
* of the results of the abstract {@link #getOptionValues(String)} method or
* {@code null} if there are no such option values.
*/
@Override
public final @Nullable String getProperty(String name) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@@ -28,7 +28,9 @@ package org.springframework.core.env;
* <p>That is, options must be prefixed with "{@code --}" and may or may not
* specify a value. If a value is specified, the name and value must be separated
* <em>without spaces</em> by an equals sign ("="). The value may optionally be
* an empty string.
* an empty string. If an option is present multiple times with different values
* &mdash; for example, {@code --foo=bar --foo=baz} &mdash; all supplied values
* will be stored for the option.
*
* <h4>Valid examples of option arguments</h4>
* <pre class="code">
@@ -37,14 +39,14 @@ package org.springframework.core.env;
* --foo=""
* --foo=bar
* --foo="bar then baz"
* --foo=bar,baz,biz</pre>
* --foo=bar,baz,biz
* --foo=bar --foo=baz --foo=biz</pre>
*
* <h4>Invalid examples of option arguments</h4>
* <pre class="code">
* -foo
* --foo bar
* --foo = bar
* --foo=bar --foo=baz --foo=biz</pre>
* --foo = bar</pre>
*
* <h3>End of option arguments</h3>
* <p>This parser supports the POSIX "end of options" delimiter, meaning that any

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@@ -23,7 +23,8 @@ import org.jspecify.annotations.Nullable;
import org.springframework.util.StringUtils;
/**
* {@link CommandLinePropertySource} implementation backed by a simple String array.
* {@link CommandLinePropertySource} implementation backed by an instance of
* {@link CommandLineArgs}.
*
* <h3>Purpose</h3>
* <p>This {@code CommandLinePropertySource} implementation aims to provide the simplest
@@ -41,7 +42,9 @@ import org.springframework.util.StringUtils;
* <p>That is, options must be prefixed with "{@code --}" and may or may not
* specify a value. If a value is specified, the name and value must be separated
* <em>without spaces</em> by an equals sign ("="). The value may optionally be
* an empty string.
* an empty string. If an option is present multiple times with different values
* &mdash; for example, {@code --foo=bar --foo=baz} &mdash; all supplied values
* will be stored for the option.
*
* <h4>Valid examples of option arguments</h4>
* <pre class="code">
@@ -50,14 +53,14 @@ import org.springframework.util.StringUtils;
* --foo=""
* --foo=bar
* --foo="bar then baz"
* --foo=bar,baz,biz</pre>
* --foo=bar,baz,biz
* --foo=bar --foo=baz --foo=biz</pre>
*
* <h4>Invalid examples of option arguments</h4>
* <pre class="code">
* -foo
* --foo bar
* --foo = bar
* --foo=bar --foo=baz --foo=biz</pre>
* --foo = bar</pre>
*
* <h3>End of option arguments</h3>
* <p>The underlying parser supports the POSIX "end of options" delimiter, meaning