Commit Graph

31176 Commits

Author SHA1 Message Date
Park Sung Jun
32df079b05 Polish use of constants in StringUtils
The hardcoded '.' and '\\' literals have been replaced by the use of
EXTENSION_SEPARATOR and WINDOWS_FOLDER_SEPARATOR_CHAR.

Closes gh-33654
2024-10-05 13:57:24 +02:00
Sam Brannen
d89983d633 Upgrade to Mockito 5.14.1 2024-10-04 17:24:55 +02:00
Sam Brannen
d957d01d14 Polishing 2024-10-04 15:48:26 +02:00
Sam Brannen
c4c005b82e Emulate AbstractAotProcessor.process() in AOT endToEndTests() 2024-10-04 15:46:23 +02:00
Sam Brannen
21d80dd849 Upgrade to JUnit 5.11.2 2024-10-04 15:39:00 +02:00
Sam Brannen
b7f394c2a1 Merge branch '6.1.x' 2024-10-04 15:36:51 +02:00
Sam Brannen
c44e43d791 Upgrade to JUnit 5.10.5 2024-10-04 15:33:25 +02:00
Sam Brannen
2569aa157e Make use of Executable abstraction in ProxyRuntimeHintsRegistrar 2024-10-04 15:05:37 +02:00
Sam Brannen
911d1b03cd Polishing 2024-10-04 15:05:37 +02:00
Sam Brannen
fb5e4c0ef2 Remove obsolete method parameter 2024-10-04 11:16:49 +02:00
Stéphane Nicoll
beca562ac2 Merge branch '6.1.x' 2024-10-04 10:20:28 +02:00
Stéphane Nicoll
c41f8ea3c8 Merge pull request #33634 from junhyeongkim2
* pr/33634:
  Use HttpMethod.GET for better readability

Closes gh-33634
2024-10-04 10:20:20 +02:00
jun
a668580f77 Use HttpMethod.GET for better readability
See gh-33634
2024-10-04 10:10:58 +02:00
SungbinYang
65ac17ee78 Refactor: Replace hardcoded path separator with PATH_SEPARATOR constant
Replaced the hardcoded '/' path separator with the `PATH_SEPARATOR` constant
to improve code readability and maintainability. This change ensures
consistency across the codebase when handling path separators.

Closes gh-33646
2024-10-04 09:19:16 +02:00
Sébastien Deleuze
d65bdce0e8 Remove CglibMethodInvocation
This class does not add anything anymore and can be
replaced by a plain ReflectiveMethodInvocation.

Closes gh-33585
2024-10-03 19:53:49 +02:00
Sébastien Deleuze
eebaa3538a Fix a regression in Cglib Kotlin proxies
The commit skips using UndeclaredThrowableStrategy for
Kotlin classes in CglibAopProxy in order to fix a
related regression caused by gh-32469.

See gh-33585
2024-10-03 19:49:59 +02:00
Sam Brannen
02094b258c Destroy singleton instead of removing and re-registering bean definition 2024-10-03 16:43:59 +02:00
Sam Brannen
39a27256a7 Reduce scope of BeanDefinitionRegistry usage in Bean Override BFPP 2024-10-03 16:39:43 +02:00
Sam Brannen
f26a266c41 Optimize BeanOverrideRegistrar lookup in BeanOverrideTestExecutionListener 2024-10-03 16:39:43 +02:00
Sam Brannen
d44701f828 Extract WrapEarlyBeanPostProcessor to top-level class 2024-10-03 16:39:43 +02:00
Sam Brannen
4c3bc3ba69 Emulate AbstractAotProcessor.process() in AotIntegrationTests 2024-10-03 16:39:43 +02:00
Simon Baslé
6c5e63e446 Merge branch '6.1.x' 2024-10-03 16:33:40 +02:00
Simon Baslé
b54420f8aa Include argument name in MethodArgumentTypeMismatchException message
Closes gh-33573
2024-10-03 16:32:29 +02:00
Sam Brannen
32309e86ce Fix context caching for Bean Overrides w/ different annotation order
Prior to this commit, ApplicationContext caching support was broken if
two Bean Override fields declared the same annotations but in a
different order.

This commit fixes that by switching to Set semantics for the
annotations declared on a Bean Override field.

Closes gh-33633
2024-10-02 11:23:48 +02:00
Brian Clozel
8cd2c40860 Improve random source in SockJS server support
Prior to this commit, the SockJs server support would use
`java.util.Random` to send a random value to clients when they request
the `/info` endpoint. Per protocol, clients can use this value as a
source of entropy for generating a random session id.

In practice, this is not used by clients. For example, the SockJS
javascript client is using a cryptographically safe API to generate
session ids.

While this has no concrete effect on known clients, this commit improves
the random source in the server support by switching to
`java.security.SecureRandom`.

Closes gh-33632
2024-10-01 21:29:19 +02:00
Sam Brannen
309897497a Update copyright header 2024-10-01 12:35:01 +02:00
Hyunwoo Kim
893f5dcb9b Replace "null" with NULL_STRING constant in ObjectUtils.nullSafeConciseToString()
Closes gh-33625
2024-10-01 12:33:40 +02:00
Sam Brannen
a21c557101 Do not replace existing Bean Override definition with pseudo-definition
Prior to this commit, BeanOverrideBeanFactoryPostProcessor replaced
existing bean definitions with "pseudo" bean definitions; however, that
is unnecessary. An existing BeanDefinition is suitable as-is and does
not need to be replaced with a pseudo/fake definition.

To address that, this commit reregisters an existing bean definition
and only registers a new bean definition when creating a bean
definition for a nonexistent bean.

As a side effect, we no longer need to copy primary and fallback flags.

Closes gh-33627
2024-10-01 12:20:27 +02:00
Sébastien Deleuze
56a0a33e5d Add a missing test case for ObjectUtils#unwrapOptional
Closes gh-33618
2024-10-01 09:42:58 +02:00
Tran Ngoc Nhan
4d87c77649 Add test cases for ObjectUtils#unwrapOptional
See gh-33618
2024-10-01 09:41:39 +02:00
SungbinYang
fc8bd64f34 Simplify ObjectUtils#unwrapOptional
This commit replaces optional.isEmpty() and optional.get() with
optional.orElse(null) for better efficiency and readability.

Closes gh-33612
2024-09-30 18:32:43 +02:00
Sam Brannen
1c87e4795d Introduce enforceOverride flag in @⁠TestBean and @⁠MockitoBean
Prior to this commit, @⁠MockitoBean could be used to either create or
replace a bean definition, but @⁠TestBean could only be used to replace
a bean definition.

However, Bean Override implementations should require the presence of
an existing bean definition by default (i.e. literally "override" by
default), while giving the user the option to have a new bean
definition created if desired.

To address that, this commit introduces a new `enforceOverride`
attribute in @⁠TestBean and @⁠MockitoBean that defaults to true but
allows the user to decide if it's OK to create a bean for a nonexistent
bean definition.

Closes gh-33613
2024-09-30 14:32:53 +02:00
Juergen Hoeller
30dc86810e Upgrade to Jackson 2.18
Closes gh-33615
2024-09-30 13:53:22 +02:00
Sam Brannen
38c9af2385 Merge branch '6.1.x' 2024-09-30 12:42:17 +02:00
Sam Brannen
0b3b1391c1 Avoid usage of deprecated AssertJ feature 2024-09-30 12:41:35 +02:00
Johnny Lim
64daba34de Upgrade to Awaitility 4.2.2
See gh-33143
Closes gh-33604
2024-09-30 12:36:54 +02:00
Juergen Hoeller
b59d0a396e Add equals/hashCode methods to ServerSentEvent
Closes gh-33606
2024-09-30 11:22:43 +02:00
Juergen Hoeller
8ab965c981 Merge branch '6.1.x'
# Conflicts:
#	spring-web/src/main/java/org/springframework/web/method/annotation/AbstractNamedValueMethodArgumentResolver.java
#	spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueArgumentResolver.java
2024-09-30 11:17:55 +02:00
Juergen Hoeller
87157d3200 Polishing 2024-09-30 11:13:50 +02:00
Juergen Hoeller
95f181352f Defensively check MethodParameter.getMethod() in KotlinDelegate
Closes gh-33609
2024-09-30 11:13:26 +02:00
Simon Baslé
854f6ffd39 Merge branch '6.1.x' 2024-09-30 10:19:36 +02:00
Simon Baslé
e32a2f339d Propagate method error in some cases of reactive findInCaches errors
In a Cacheable reactive method, if an exception is propagated from
both the method and the caching infrastructure, an NPE could previously
surface due to the `CacheAspectSupport` attempting to perform an
`onErrorResume` with a `null`. This change ensures that in such a case
the user-level exception from the method is propagated instead.

Closes gh-33492
2024-09-30 10:18:59 +02:00
Sam Brannen
d79258ac73 Reject non-singletons in Test Bean Override support
Prior to this commit, a non-singleton FactoryBean was silently replaced
by a singleton bean. In addition, bean definitions for prototype-scoped
and custom-scoped beans were replaced by singleton bean definitions
that were incapable of creating the desired bean instance. For example,
if the bean type of the original bean definition was a concrete class,
an attempt was made to invoke the default constructor which either
succeeded with undesirable results or failed with an exception if the
bean type did not have a default constructor. If the bean type of the
original bean definition was an interface or a FactoryBean that claimed
to create a bean of a certain interface type, an attempt was made to
instantiate the interface which always failed with a
BeanCreationException.

To address the aforementioned issues, this commit reworks the logic in
BeanOverrideBeanFactoryPostProcessor so that an exception is thrown
whenever an attempt is made to override a non-singleton bean.

Closes gh-33602
2024-09-29 18:12:00 +02:00
Sam Brannen
4e9b503055 Polish OverrideMetadata 2024-09-29 18:02:09 +02:00
Sam Brannen
ba1d01d9b7 Add missing final declaration to OverrideMetadata.getBeanName() 2024-09-29 16:31:20 +02:00
Sam Brannen
5c08f81d80 Polishing 2024-09-29 16:28:06 +02:00
Sam Brannen
625614a4d2 Stop "collecting" annotations in MockitoAnnotationDetector
There is no need to collect/track the actual annotations. Rather, we
only need to know if there is at least once such annotation present.
2024-09-29 15:34:40 +02:00
Sam Brannen
40ca83dfd4 Revise Bean Override internals and Javadoc 2024-09-28 17:13:24 +02:00
Juergen Hoeller
56f3a48879 Merge branch '6.1.x'
# Conflicts:
#	spring-context/src/main/java/org/springframework/context/aot/AbstractAotProcessor.java
2024-09-27 19:17:32 +02:00
Juergen Hoeller
9f4968ed05 Polishing 2024-09-27 19:16:12 +02:00