Commit Graph

28143 Commits

Author SHA1 Message Date
Sam Brannen
985eb5b8a1 Merge branch '6.0.x' 2023-09-29 13:52:44 +02:00
Sam Brannen
9aab4a60f5 Support safe navigation operator with void methods in SpEL
Prior to this commit the Spring Expression Language (SpEL) was able to
properly parse an expression that uses the safe navigation operator
(?.) with a method that has a `void` return type (for example,
"myObject?.doSomething()"); however, SpEL was not able to evaluate or
compile such expressions.

This commit addresses the evaluation issue by selectively not boxing
the exit type descriptor (for inclusion in the generated bytecode) when
the method's return type is `void`.

This commit addresses the compilation issue by pushing a null object
reference onto the stack in the generated byte code when the method's
return type is `void`.

Closes gh-27421
2023-09-29 13:49:48 +02:00
Sam Brannen
1fe2216c59 Test status quo for null-safe Void method references in SpEL 2023-09-29 13:36:38 +02:00
Sam Brannen
5ff9e6955c Test status quo for void function references in SpEL 2023-09-29 13:36:38 +02:00
Sam Brannen
0cb4043aac Polishing 2023-09-29 13:36:38 +02:00
Stéphane Nicoll
9e144afc0d Merge pull request #31328 from vpavic
* pr/31328:
  Polish "Fix regression in JmsAccessor#setSessionAcknowledgeMode"
  Fix regression in JmsAccessor#setSessionAcknowledgeMode

Closes gh-31328
2023-09-29 08:43:26 +02:00
Stéphane Nicoll
95e6902aef Polish "Fix regression in JmsAccessor#setSessionAcknowledgeMode"
See gh-31328
2023-09-29 08:42:56 +02:00
Vedran Pavic
11c2cde62e Fix regression in JmsAccessor#setSessionAcknowledgeMode
This commit partially reverts 3b8dd0a5, which introduced a strict
validation in JmsAccessor#setSessionAcknowledgeMode that prevents use
of vendor-specific acknowledge modes.

See gh-31328
2023-09-29 08:42:38 +02:00
Stéphane Nicoll
ce9ca700f3 Enable test in AbstractAspectJAdvisorFactoryTests
See gh-24190
2023-09-28 15:46:47 +02:00
Juergen Hoeller
ef61b4eff3 SimpleAsyncTaskScheduler runs fixed-delay tasks on scheduler thread
Closes gh-31334
2023-09-28 14:34:01 +02:00
Juergen Hoeller
86b764d4d2 Expose public shouldHandle(ApplicationEvent) method
Closes gh-31295
2023-09-28 14:33:26 +02:00
Juergen Hoeller
38a0e17ede Prefer query(Class) method in javadoc example
See gh-26594
2023-09-28 14:33:20 +02:00
Stéphane Nicoll
b9bbfb79a4 Merge branch '6.0.x' 2023-09-28 09:32:28 +02:00
Stéphane Nicoll
6030e62766 Merge pull request #31330 from jihuayu
* pr/31330:
  Add missing `conversionService` field in doc example

Closes gh-31330
2023-09-28 09:32:20 +02:00
纪华裕
867b9f61b2 Add missing conversionService field in doc example
See gh-31330
2023-09-28 09:30:50 +02:00
Sam Brannen
515d8aae94 Merge branch '6.0.x' 2023-09-27 16:43:56 +02:00
Sam Brannen
6300fb37ad Include '?' for null-safe navigation in SpEL AST representations
Prior to this commit, if a Spring Expression Language (SpEL) expression
contained property, field, or method references using the null-safe
navigation operator (?.), the generated AST String representation
incorrectly omitted the '?' characters.

For example, 'myProperty?.myMethod()' had a generated AST string
representation of 'myProperty.myMethod()'.

This commit addresses this by introducing isNullSafe() in
MethodReference and reworking the logic in
CompoundExpression.toStringAST().

Closes gh-31326
2023-09-27 16:42:27 +02:00
Sam Brannen
0d22569422 Polishing 2023-09-27 16:34:18 +02:00
Sam Brannen
47ed4e6c78 Merge branch '6.0.x' 2023-09-27 13:19:39 +02:00
Sam Brannen
06658c3c71 Restore zero capacity support in ConcurrentLruCache
Since the rewrite of ConcurrentLruCache in Spring Framework 6.0, an
attempt to create a ConcurrentLruCache with zero capacity results in an
IllegalArgumentException even though the documentation states that zero
capacity indicates "no caching, always generating a new value".

This commit restores the ability to configure a ConcurrentLruCache with
zero capacity and introduces corresponding tests (which were first
verified against the 5.3.x branch to ensure backward compatibility).

See gh-26320
Closes gh-31317
2023-09-27 13:18:30 +02:00
Sam Brannen
45d8aadb0a Polishing 2023-09-27 10:19:51 +02:00
Stéphane Nicoll
b5db730ca0 Merge pull request #31267 from kang-hl
* pr/31267:
  Update copyright year of changed file
  Optimize MessageSourceSupport

Closes gh-31267
2023-09-27 09:16:57 +02:00
Stéphane Nicoll
182f9117aa Update copyright year of changed file
See gh-31267
2023-09-27 09:14:20 +02:00
kanghailin
08271fa445 Optimize MessageSourceSupport
See gh-31267
2023-09-27 09:13:53 +02:00
Stéphane Nicoll
6486c2a537 Merge pull request #31320 from chaewon121
* pr/31320:
  Polish contribution
  Polish Conditional Statements

Closes gh-31320
2023-09-27 09:01:58 +02:00
Stéphane Nicoll
7a05d23597 Polish contribution
See gh-31320
2023-09-27 08:58:11 +02:00
chaewon121
d6a105c151 Polish Conditional Statements
See gh-31320
2023-09-27 08:57:55 +02:00
Sam Brannen
d50ec68ad7 Polish contribution
See gh-31248
2023-09-26 13:49:03 +02:00
Lee Jaeheon
6d2d8a36c2 Introduce initialize() in AbstractRouting[DataSource|ConnectionFactory]
This commit introduces initialize() methods in
AbstractRoutingDataSource and AbstractRoutingConnectionFactory as an
alternative to invoking afterPropertiesSet().

Closes gh-31248
2023-09-26 13:20:11 +02:00
Stéphane Nicoll
af0b39a722 Merge pull request #31282 from sephiroth-j
* pr/31282:
  Polish "Use `singleOrEmpty()` instead of `buffer()`"
  Use `singleOrEmpty()` instead of `buffer()`

Closes gh-31282
2023-09-26 12:37:42 +02:00
Stéphane Nicoll
f9291214ec Polish "Use singleOrEmpty() instead of buffer()"
See gh-31282
2023-09-26 12:37:28 +02:00
Ronny Perinke
cbfb99fef2 Use singleOrEmpty() instead of buffer()
This commit avoids fetching and buffering results in temporary `List` buffers.

See gh-31282
2023-09-26 12:37:28 +02:00
rstoyanchev
2e2a62a23c Polishing 2023-09-26 11:34:40 +01:00
rstoyanchev
af7fe013b6 MockMvcHttpConnector supports RequestPostProcessor's
Closes gh-31298
2023-09-26 11:34:40 +01:00
Stéphane Nicoll
0f6b018e97 Merge branch '6.0.x' 2023-09-26 12:30:05 +02:00
Stéphane Nicoll
a37abd5e54 Provide best-effort toString for Lazy resolved message
Previously, MessagingMessageListenerAdapter or any adapter relying on
the default MessagingMessageConverter would log an incoming message
with a toString of the Message that does not provide any extra
information. This is due to the default implementation providing a
lazy resolution message that only attempts to extract the payload
when necessary.

This commit implements a toString method that uses the raw JMS message
if the payload is not available. If it is, the payload is used instead.

Closes gh-21265
2023-09-26 12:29:00 +02:00
Sam Brannen
225c9062a1 Merge branch '6.0.x' 2023-09-25 20:19:11 +02:00
Sam Brannen
18456dec52 Reintroduce FastClass in CGLIB class names for @⁠Configuration classes
Given a @⁠Configuration class named org.example.AppConfig which
contains @⁠Bean methods, in Spring Framework 5.3.x and previous
versions, the following classes were created when generating the CGLIB
proxy.

org.example.AppConfig$$EnhancerBySpringCGLIB$$fd7e9baa
org.example.AppConfig$$FastClassBySpringCGLIB$$3fec86e
org.example.AppConfig$$EnhancerBySpringCGLIB$$fd7e9baa$$FastClassBySpringCGLIB$$82534900

Those class names indicate that 1 class was generated for the proxy for
the @⁠Configuration class itself and that 2 additional FastClass
classes were generated to support proxying of @⁠Bean methods in
superclasses.

However, since Spring Framework 6.0, the following classes are created
when generating the CGLIB proxy.

org.example.AppConfig$$SpringCGLIB$$0
org.example.AppConfig$$SpringCGLIB$$1
org.example.AppConfig$$SpringCGLIB$$2

The above class names make it appear that 3 proxy classes are generated
for each @⁠Configuration class, which is misleading.

To address that and to align more closely with how such generated
classes were named in previous versions of the framework, this commit
modifies SpringNamingPolicy so that generated class names once again
include "FastClass" when the generated class is for a CGLIB FastClass
as opposed to the actual proxy for the @⁠Configuration class.

Consequently, with this commit the following classes are created when
generating the CGLIB proxy.

org.example.AppConfig$$SpringCGLIB$$0
org.example.AppConfig$$SpringCGLIB$$FastClass$$0
org.example.AppConfig$$SpringCGLIB$$FastClass$$1

Closes gh-31272
2023-09-25 20:17:10 +02:00
Sam Brannen
d17c75a7ef Test status quo for SpringNamingPolicy
See gh-31272
2023-09-25 20:14:29 +02:00
Sam Brannen
f547b6ad2a Polishing 2023-09-25 20:14:29 +02:00
Sam Brannen
7aae97bcd4 Revise NO_VIOLATIONS_DETECTED in SpringExtension to clarify intent
See gh-31305
See gh-30962
See gh-30456
2023-09-25 16:48:58 +02:00
Stéphane Nicoll
d36c4f75e3 Merge branch '6.0.x' 2023-09-25 15:27:20 +02:00
Stéphane Nicoll
e1bd13d3d6 Fix note on CGLIB supported method visibility
CGLIB do support package-private and protected methods now so the
note in the reference doc should be changed accordingly.

Closes gh-25001
2023-09-25 15:27:07 +02:00
Stéphane Nicoll
daa902bf20 Merge pull request #31305 from alidandach
* pr/31305:
  Use Objects.equals() for null-safe string comparison

Closes gh-31305
2023-09-25 08:33:05 +02:00
ali dandach
1d12c74042 Use Objects.equals() for null-safe string comparison
See gh-31305
2023-09-25 08:28:33 +02:00
Sam Brannen
bc3d98565c Update copyright headers 2023-09-23 13:36:41 +02:00
Sam Brannen
a88d5d1c62 Polishing 2023-09-23 13:36:30 +02:00
Sam Brannen
d0a088f9dc Clean up warnings in tests 2023-09-23 13:30:05 +02:00
Sam Brannen
ebd4f1b45b Merge branch '6.0.x' 2023-09-23 12:41:19 +02:00
Sam Brannen
08237da4b4 Simplify equals() implementation in PerTargetInstantiationModelPointcut
For equivalence, we only need to compare the preInstantiationPointcut
fields since they include the declaredPointcut fields. In addition, we
should not compare the aspectInstanceFactory fields since
LazySingletonAspectInstanceFactoryDecorator does not implement equals().

See gh-31238
2023-09-23 12:40:28 +02:00