Commit Graph

32657 Commits

Author SHA1 Message Date
Stéphane Nicoll
313b063aef Polish 2024-08-07 15:28:52 +02:00
Simon Baslé
7052af97a6 Polish test to focus on the FactoryBean results being mocked 2024-08-07 14:57:15 +02:00
Simon Baslé
1c893e6354 Add @MockitoBeanSettings, use MockitoSession with strict stubs default
This commit changes the way the `MockitoTestExecutionListener` sets up
mockito, now using the `MockitoSession` feature. Additionally, stubbing
now defaults to a STRICT mode which can be overruled with a newly
introduced annotation: `@MockitoBeanSettings`.

Closes gh-33318
2024-08-07 14:57:15 +02:00
Stéphane Nicoll
bc05474271 Merge branch '6.1.x' 2024-08-07 10:26:07 +02:00
Stéphane Nicoll
88a408474d Start building against Reactor 2024.0.0-M5 snapshots
See gh-33328
2024-08-07 10:22:53 +02:00
Stéphane Nicoll
5a99407847 Start building against Reactor 2023.0.9 snapshots
See gh-33326
2024-08-07 10:02:20 +02:00
Stéphane Nicoll
05bd246cab Start building against Micrometer 1.12.9 snapshots
See gh-33325
2024-08-07 10:01:54 +02:00
Sam Brannen
a698f66c3a Merge branch '6.1.x'
# Conflicts:
#	spring-expression/src/main/java/org/springframework/expression/spel/support/SimpleEvaluationContext.java
2024-08-06 13:56:57 +03:00
Sam Brannen
0127de5a7a Enforce read-only semantics in SpEL's SimpleEvaluationContext
SimpleEvaluationContext.forReadOnlyDataBinding() documents that it
creates a SimpleEvaluationContext for read-only access to public
properties; however, prior to this commit write access was not disabled
for indexed structures when using the assignment operator, the
increment operator, or the decrement operator.

In order to better align with the documented contract for
forReadOnlyDataBinding(), this commit makes it possible to disable
assignment in general in order to enforce read-only semantics for
SpEL's SimpleEvaluationContext when created via the
forReadOnlyDataBinding() factory method. Specifically:

- This commit introduces a new isAssignmentEnabled() "default" method
  in the EvaluationContext API, which returns true by default.

- SimpleEvaluationContext overrides isAssignmentEnabled(), returning
  false if the context was created via the forReadOnlyDataBinding()
  factory method.

- The Assign, OpDec, and OpInc AST nodes -- representing the assignment
  (=), increment (++), and decrement (--) operators, respectively --
  now throw a SpelEvaluationException if assignment is disabled for the
  current EvaluationContext.

Closes gh-33319
2024-08-06 13:54:11 +03:00
Juergen Hoeller
28668d774b Enforce non-null value in requiredSingleResult/requiredUniqueResult
Closes gh-33300
2024-08-05 15:53:17 +02:00
Sam Brannen
1e804d8d4f Merge branch '6.1.x' 2024-08-05 16:37:57 +03:00
Sam Brannen
fcc99a67b6 Support lists for varargs invocations in SpEL
The changes made in conjunction with gh-33013 resulted in a regression
for varargs support in SpEL expressions. Specifically, before gh-33013
one could supply a list -- for example, an "inline list" -- as the
varargs array when invoking a varargs constructor, method, or function
within a SpEL expression. However, after gh-33013 an inline list (or
collection in general) is no longer converted to an array for varargs
invocations. Instead, the list is supplied as a single argument of the
resulting varargs array which breaks applications that depend on the
previous behavior.

Although it was never intended that one could supply a collection as
the set of varargs, we concede that this is a regression in existing
behavior, and this commit therefore restores support for supplying a
java.util.List as the varargs "array".

In addition, this commit introduces the same "list to array" conversion
support for MethodHandle-based functions that accept varargs.

Note, however, that this commit does not restore support for converting
arbitrary single objects to an array for varargs invocations if the
single object is already an instance of the varargs array's component
type.

See gh-33013
Closes gh-33315
2024-08-05 16:28:11 +03:00
Sam Brannen
8afff3359b Polishing 2024-08-05 15:01:41 +03:00
rstoyanchev
622c1b9e8c WebMvc support for SSE Fragment stream
Closes gh-33194
2024-08-05 14:38:23 +03:00
rstoyanchev
184bb7c23c Polishing in ResponseBodyEmitterReturnValueHandler
See gh-33194
2024-08-05 14:38:23 +03:00
Sam Brannen
f3ab3905b8 Merge branch '6.1.x' 2024-08-05 14:21:27 +03:00
Sam Brannen
c57c2272a1 Throw exception for failure to set property as index in SpEL
Prior to this commit, the Indexer in the Spring Expression Language
(SpEL) silently ignored a failure to set a property via the indexed
property syntax (['<property name>'] = <new value>) – for example, if
property write access was disabled in the EvaluationContext.

This commit addresses this issue by properly throwing a
SpelEvaluationException in PropertyIndexingValueRef.setValue(Object) if
the property could not be set.

Closes gh-33310
2024-08-05 14:15:55 +03:00
Sam Brannen
8ec23a0fcc Polishing 2024-08-05 14:15:39 +03:00
Sam Brannen
74b0bb105e Merge branch '6.1.x' 2024-08-05 11:58:49 +03:00
Sam Brannen
8badae9d72 Convert primitive array to Object[] when invoking varargs method in SpEL
Prior to this commit, SpEL incorrectly wrapped a primitive array in an
Object[] array when invoking Object[] varargs methods and constructors.

This commit addresses this by updating the convertArguments(...) method
in ReflectionHelper as follows when the user supplies the varargs
already packaged in a primitive array.

- When deciding whether to convert a single element passed as varargs,
  we now check if the argument is an array that is assignable to the
  varargs array type.

- When converting an array supplied as the varargs, we convert that
  array to the varargs array type.

Closes gh-33317
2024-08-05 11:56:48 +03:00
Sam Brannen
46a4ad4a75 Merge branch '6.1.x' 2024-08-05 11:07:47 +03:00
Stéphane Nicoll
5c3f1b1741 Merge pull request #33316 from zinzoddari
* pr/33316:
  Polishing Javadoc and comment

Closes gh-33316
2024-08-05 10:06:33 +02:00
Sam Brannen
444e7eeb74 Enable test for primitive array to Object[] conversion in SpEL
See gh-33212
2024-08-05 11:05:53 +03:00
zinzo
edbaf68707 Polishing Javadoc and comment
See gh-33316
2024-08-05 10:05:00 +02:00
Stéphane Nicoll
6bcffe3b4a Shorten PR jobs to 60 minutes
See gh-33302
2024-08-05 10:03:25 +02:00
Sam Brannen
f4604cfab3 Merge branch '6.1.x' 2024-08-04 17:14:10 +03:00
Sam Brannen
cb6a5baac5 Support conversion from primitive array to Object[] in ConversionService
Prior to this commit, the ConversionService failed to convert a primitive
array (such as int[]) to an Object[] due to an error in the logic in
ArrayToArrayConverter.

This commit addresses this by augmenting the "can bypass conversion"
check in ArrayToArrayConverter to ensure that the supplied source object
is an instance of the target type (i.e., that the source array can be
cast to the target type array without conversion).

Closes gh-33212
2024-08-04 17:13:56 +03:00
Stéphane Nicoll
776a1d45f8 Merge branch '6.1.x' 2024-08-04 09:34:38 +02:00
Stéphane Nicoll
3b2a818f1e Upgrade to Java 17.0.12 2024-08-04 09:34:13 +02:00
Stéphane Nicoll
499cf5e84c Merge pull request #33308 from benelog
* pr/33308:
  Remove duplicated "the" in Javadoc

Closes gh-33308
2024-08-03 09:54:39 +02:00
Sanghyuk Jung
ca377e4854 Remove duplicated "the" in Javadoc
See gh-33308
2024-08-03 09:52:23 +02:00
Stéphane Nicoll
0a2611b22f Harmonize NoUniqueBeanDefinitionException message
This commit makes sure that the programmatic exception that is thrown
by the cache abstraction uses the same message structure as a default
message produced by NoUniqueBeanDefinitionException.

Closes gh-33305
2024-08-02 16:24:43 +02:00
Stéphane Nicoll
29dce74fcd Merge branch '6.1.x' 2024-08-02 10:57:57 +02:00
Stéphane Nicoll
84d1122190 Shorten CI and deploy snapshot jobs to 60 minutes
Closes gh-33302
2024-08-02 10:56:25 +02:00
Stéphane Nicoll
3aec39973c Polish 2024-08-02 09:16:15 +02:00
Simon Baslé
25f62c8765 Merge branch '6.1.x' 2024-08-01 16:29:52 +02:00
Simon Baslé
722dcae1b1 Fix buffer leak in MultipartParser
This change fixes a buffer leak when the MultipartParser is encountering
a body DataBuffer that only contains a boundary.

Closes gh-33094
2024-08-01 16:28:50 +02:00
Stéphane Nicoll
47780747ba Merge pull request #33298 from zinzoddari
* pr/33298:
  Polish "Improve test coverage of StringUtils"
  Improve test coverage of StringUtils

Closes gh-33298
2024-08-01 07:35:01 +02:00
Stéphane Nicoll
ec9d29ea8f Polish "Improve test coverage of StringUtils"
See gh-33298
2024-08-01 07:32:41 +02:00
zinzo
a2cae4c8f4 Improve test coverage of StringUtils
This commit adds tests for `trimArrayElements()` and
`delimitedListToStringArray()` in StringUtils.

See gh-33298
2024-08-01 07:23:28 +02:00
Stéphane Nicoll
f63fc01d22 Merge branch '6.1.x' 2024-07-31 16:56:22 +02:00
Stéphane Nicoll
850a0de1b0 Suppress deprecated warnings for autowiring
This commit extends our handling of deprecated with AOT to autowiring.

Closes gh-33295
2024-07-31 16:51:06 +02:00
rstoyanchev
31a3119784 Add FilterRegistration's defensively
Follow-up to d2225c, which broke Boot tests because the ServletContext can
be the one of the embedded Servlet container if initializing a live server
and as well as MockMvc (e.g. via `@AutoConfigureMockMvc`).

See gh-33252
2024-07-31 14:50:08 +03:00
Simon Baslé
f1a99cd968 Allow setting filename for inline elements in MimeMessageHelper
This change adds several overloads of `MimeMessageHelper#addInline`
which allow users to specify a file name for inline elements added from
an `InputStreamResource` or a `jakarta.activation.DataSource`.

Closes gh-33230
2024-07-31 11:39:16 +02:00
Stéphane Nicoll
c71f98acba Merge branch '6.1.x' 2024-07-30 17:21:28 +02:00
Stéphane Nicoll
321e8a58ae Document that NoOpResponseErrorHandler is not a good fit with RestClient
Closes gh-33276
2024-07-30 17:17:39 +02:00
Simon Baslé
6174d95ba2 Add multi-unit DurationFormat.Style for duration parsing/printing
This adds the COMPOSITE style, which allows multiple segments each
similar to the SIMPLE style.

See gh-30396
Closes gh-33262
2024-07-30 16:58:42 +02:00
rstoyanchev
f967f6f9f0 Update contribution
Closes gh-33220
2024-07-30 13:15:21 +03:00
Seokjae Lee
5e9308e0cb Flexible collection handling in RequestParamArgumentResolver
See gh-33220
2024-07-30 11:42:44 +03:00
rstoyanchev
dbc69284c8 ResponseEntityExceptionHandler handles AsyncRequestNotUsableException
Closes gh-33225
2024-07-30 11:33:47 +03:00