Commit Graph

1938 Commits

Author SHA1 Message Date
Juergen Hoeller
bd65a19d71 Introduce write method fallback step for overloaded setter methods
Closes gh-31872
2023-12-21 14:32:10 +01:00
Juergen Hoeller
4c0d0ba5b3 Use standard String comparison in PropertyDescriptorComparator
Closes gh-31866
2023-12-20 08:45:53 +01:00
Stéphane Nicoll
d0574197ea Polish "Use String.repeat instead of explicit cycle"
See gh-31802
2023-12-18 14:10:16 +01:00
Adam Ostrožlík
63b2787da6 Use String.repeat instead of explicit cycle
See gh-31802
2023-12-18 13:54:03 +01:00
dogglezz
503ccb577c Remove unused imports
Closes gh-31851
2023-12-15 09:35:17 +01:00
Juergen Hoeller
d4406507d0 Polishing 2023-12-14 00:12:22 +01:00
Juergen Hoeller
cd64e6676c Prepare method overrides when bean class gets resolved
See gh-31826
2023-12-13 14:33:13 +01:00
Stéphane Nicoll
409cecfff9 Add custom code generation for bean definition property values
This commits allows ValueCodeGenerator$Delegate implementations to be
loaded from `META-INF/spring/aot.factories` and considered for code
generation of bean definition property values. This default behavior
in DefaultBeanRegistrationCodeFragments can be customized as usual.

Closes gh-31427
2023-12-13 07:14:55 +01:00
Stéphane Nicoll
3c2c9ca186 Extract value code generation to make it reusable
This commit introduces ValueCodeGenerator and its Delegate interface
as a way to generate the code for a particular value. Implementations
in spring-core provides support for common value types such a String,
primitives, Collections, etc.

Additional implementations are provided for code generation of bean
definition property values.

Closes gh-28999
2023-12-13 07:05:58 +01:00
Stéphane Nicoll
c75c0ae2d5 Make sure interface method has hints for init/destroy invocation
This commit matches the behavior of the core container when it
invokes a custom init or destroy method. If the custom method is an
interface implementation, the core container attempts to invoke the
method that's defined on the interface. This commit makes sure to also
register a hint for the interface method.

Closes gh-31819
2023-12-12 14:57:35 +01:00
Sam Brannen
c0683cd30b Update copyright headers 2023-12-12 14:51:03 +01:00
Sam Brannen
1c58511cb2 Polishing 2023-12-12 14:51:03 +01:00
Stéphane Nicoll
b85fcb6aec Polish 2023-12-12 13:56:56 +01:00
Juergen Hoeller
6dcba4de2c Avoid double proxying for @Resource @Lazy fallback autowiring
Includes refactored @Resource resolver for AOT with lazy resolution support.

Closes gh-31447
See gh-29614
2023-12-12 12:39:59 +01:00
Juergen Hoeller
f29bfd9769 Polishing 2023-12-10 00:28:51 +01:00
Juergen Hoeller
361dfd1ae4 Polishing 2023-12-09 23:51:18 +01:00
Juergen Hoeller
8704ad98a7 Clear caches which are not needed after singleton instantiation
Closes gh-28293
2023-12-09 23:50:54 +01:00
Yanming Zhou
afcd03bddc Replace assertThat(x.isEmpty()).isTrue() with assertThat(x).isEmpty()
Search for   : assertThat\((.+).isEmpty\(\)\).isTrue\(\)
Replace with : assertThat($1).isEmpty()

Search for   : assertThat\((.+).isEmpty\(\)\).isFalse\(\)
Replace with : assertThat($1).isNotEmpty()

Closes gh-31758
2023-12-06 10:04:56 +01:00
Yanming Zhou
7b16ef90f1 Replace assertThat(x.equals(y)) with assertThat(x).isEqualTo(y)
Search for   : assertThat\((.+)\.equals\((\w+)\)\)\.isTrue\(\)
Replace with : assertThat($1).isEqualTo($2)

Search for   : assertThat\((.+)\.equals\((\w+)\)\)\.isFalse\(\)
Replace with : assertThat($1).isNotEqualTo($2)

Closes gh-31763
2023-12-06 09:50:15 +01:00
Yanming Zhou
e2852e7355 Replace assertThat(x.contains(y)).isTrue() with assertThat(x).contains(y)
Search for   : assertThat\((.+)\.contains\((.+)\)\)\.isTrue\(\)
Replace with : assertThat($1).contains($2)

Search for   : assertThat\((.+)\.contains\((.+)\)\)\.isFalse\(\)
Replace with : assertThat($1).doesNotContain($2)

Closes gh-31762
2023-12-06 09:48:49 +01:00
Yanming Zhou
66e405525b Replace assertThat(x instanceof y).isTrue() with assertThat(x).isInstanceOf(y.class)
Search for   : assertThat\((.+) instanceof (\w+)\)\.isTrue\(\)
Replace with : assertThat($1).isInstanceOf($2.class)

Search for   : assertThat\((.+) instanceof (\w+)\)\.isFalse\(\)
Replace with : assertThat($1).isNotInstanceOf($2.class)

Closes gh-31760
2023-12-06 09:46:44 +01:00
Yanming Zhou
59815cefce Replace assertThat(x.get(i)). with assertThat(x).element(i).
Search for   : assertThat\((.+)\.get\((\d+)\)\)\.
Replace with : assertThat($1).element($2).

Closes gh-31759
2023-12-06 09:43:59 +01:00
Yanming Zhou
785ad399e9 Replace assertThat(x.iterator().next()) with assertThat(x).element(0)
Search for   : assertThat\((.+).iterator\(\).next\(\)\)
Replace with : assertThat($1).element(0)
2023-12-06 10:52:39 +08:00
Sam Brannen
aa347e5fe6 Polish MutablePropertyValuesTests 2023-12-05 11:43:57 +01:00
Sam Brannen
ceba4162bb Replace assertThat(!x).isTrue() with assertThat(x).isFalse()
Search for   : assertThat\(!(.+)\).isTrue\(\)

Replace with : assertThat(\1).isFalse()
2023-12-05 11:41:57 +01:00
Stéphane Nicoll
1da40b84e7 Polish "Use idiomatic AssertJ map assertions"
See gh-31752
2023-12-05 10:39:33 +01:00
Yanming Zhou
6f11716b6f Use idiomatic AssertJ map assertions
See gh-31752
2023-12-05 10:01:38 +01:00
Sam Brannen
d71853f105 Polish contribution
See gh-31531
2023-12-04 16:47:25 +01:00
Yanming Zhou
490b5c77fc Use switch expression where feasible 2023-12-04 15:42:55 +01:00
Sam Brannen
c05b4ce776 Suppress warnings in Gradle build 2023-12-01 15:44:37 +01:00
Sébastien Deleuze
16ac495084 Introduce ORDER_ATTRIBUTE on AbstractBeanDefinition
This commit allows to define a bean order programmatically
at bean definition level (functional equivalent of
`@Order`).

If specified, the order attribute defined at bean
definition level overrides potential values set with
`@Order`.

See gh-30849
2023-11-30 18:09:00 +01:00
Juergen Hoeller
c56c304536 PathEditor considers single-letter URI scheme as NIO path candidate
Closes gh-29881
2023-11-30 14:16:05 +01:00
Yanming Zhou
feef98b73c Correct conversion from Resource[] with length 1 to Collection<Resource>
Fix GH-31693
2023-11-30 14:05:13 +01:00
Krane
894dce7cd8 Optimize loops on BeanDefinitionPropertiesCodeGenerator
Closes gh-31650
2023-11-24 16:30:24 +01:00
Juergen Hoeller
48f3c08395 Test for mixed order across bean factory hierarchy
See gh-28374
2023-11-22 12:38:04 +01:00
Johnny Lim
2b750926c3 Polishing
Closes gh-31522
2023-10-30 15:05:20 +01:00
Stéphane Nicoll
1762bf4a60 Fix code generation for null indexed argument value
This commit fixes code generation when an indexed constructor argument
value is null as the method is overloaded and need the value to be
cast to `Object`.

Closes gh-31508
2023-10-28 10:52:26 +02:00
Stéphane Nicoll
4977ef9cea Import ConstructorResolver to handle null values
Previously, ConstructorResolver would reject any candidate if the
parameter is `null`. The reason for that is that null does not carry
any type and the matching algorithm would systematically fail for that
argument.

This commit adds an extra check, and several tests, to validate that
a null value is taken into account.

Closes gh-31495
2023-10-25 17:59:11 +02:00
Juergen Hoeller
83870e35d1 TypeDescriptor/ResolvableType cache in GenericTypeAwarePropertyDescriptor
Closes gh-31490
2023-10-24 23:13:19 +02:00
Juergen Hoeller
93b0b66735 Merge branch '6.0.x'
# Conflicts:
#	spring-beans/src/main/java/org/springframework/beans/BeanUtils.java
#	spring-core/src/main/java/org/springframework/core/ResolvableType.java
#	spring-core/src/test/java/org/springframework/core/ResolvableTypeTests.java
2023-10-24 22:58:31 +02:00
Juergen Hoeller
925fa0272b Polishing 2023-10-24 22:53:44 +02:00
Juergen Hoeller
09aa59f9e7 Avoid ResolvableType for simple assignability check in copyProperties
Closes gh-27246
2023-10-24 22:53:00 +02:00
Stéphane Nicoll
999b5d4462 Better error reporting when instance does not match factory method
This commit improves the handling of IllegalArgumentException in
SimpleInstantiationStrategy. Previously, only arguments mismatch were
handled but the exception can also be thrown if the factory instance
does not match the target method.

Closes gh-28897
2023-10-24 13:29:12 +02:00
Stéphane Nicoll
6299a9dfc9 Add tests for SimpleInstantiationStrategy 2023-10-24 13:29:12 +02:00
Juergen Hoeller
8712fdcd3b Polishing 2023-10-23 17:36:06 +02:00
Juergen Hoeller
cf3a25bfac Merge branch '6.0.x' 2023-10-23 17:34:45 +02:00
Juergen Hoeller
6bdf7ad36a Polishing 2023-10-23 17:32:45 +02:00
Juergen Hoeller
6dc79b5105 Declare empty default postProcessBeanFactory method
Closes gh-31476
2023-10-23 16:56:05 +02:00
Stéphane Nicoll
3cb700c103 Merge branch '6.0.x' 2023-10-23 11:34:12 +02:00
Stéphane Nicoll
f3dce4bb9a Polish "Ignore @Value on record property"
See gh-31433
2023-10-23 11:20:49 +02:00