Commit Graph

2170 Commits

Author SHA1 Message Date
Sébastien Deleuze 96f7d50abf Remove unneeded NullAway warning suppressions
This commit removes warning suppressions related to uber/NullAway#1113
which is now fixed.

See gh-28797
2025-01-07 09:57:56 +01:00
Sébastien Deleuze c245e20e3f Refine null-safety in the spring-beans module
See gh-34152
2024-12-26 14:18:48 +01:00
Sébastien Deleuze 185537d469 Refine jsr305 dependency management
See gh-28797
2024-12-26 14:13:17 +01:00
Sébastien Deleuze 8b741f3a46 Refine null-safety in the spring-beans module
Closes gh-34152
2024-12-26 11:24:05 +01:00
Sébastien Deleuze 0e85d950b3 Remove unneeded `@NonNull` annotations
See gh-28797
2024-12-19 11:07:33 +01:00
Sébastien Deleuze bc5d771a06 Switch to JSpecify annotations
This commit updates the whole Spring Framework codebase to use JSpecify
annotations instead of Spring null-safety annotations with JSR 305
semantics.

JSpecify provides signficant enhancements such as properly defined
specifications, a canonical dependency with no split-package issue,
better tooling, better Kotlin integration and the capability to specify
generic type, array and varargs element null-safety. Generic type
null-safety is not defined by this commit yet and will be specified
later.

A key difference is that Spring null-safety annotations, following
JSR 305 semantics, apply to fields, parameters and return values,
while JSpecify annotations apply to type usages. That's why this
commit moves nullability annotations closer to the type for fields
and return values.

See gh-28797
2024-12-19 11:07:23 +01:00
Sébastien Deleuze f094c46172 Merge branch '6.2.x' 2024-12-17 11:40:53 +01:00
luozongle01 a942362221 Fix a typo
Closes gh-34101
2024-12-17 11:40:47 +01:00
Sam Brannen 1ef7e70950 Merge branch '6.2.x' 2024-12-11 15:04:43 +01:00
Sam Brannen 41d9f21ab9 Log alias removal in DefaultListableBeanFactory
Prior to this commit, information was logged when a bean definition
overrode an existing bean definition, but nothing was logged when the
registration of a bean definition resulted in the removal of an alias.

With this commit, an INFO message is now logged whenever an alias is
removed in DefaultListableBeanFactory.

Closes gh-34070
2024-12-11 15:03:52 +01:00
Juergen Hoeller 3d19d78461 Merge branch '6.2.x' 2024-12-10 16:26:56 +01:00
Juergen Hoeller 66da5d7ab9 Restore original override behavior when override allowed
Closes gh-33920
2024-12-10 16:25:49 +01:00
Stéphane Nicoll f8fd6da10b Merge branch '6.2.x' 2024-12-06 15:42:15 +01:00
Stéphane Nicoll 0d72477742 Restore user type in generated root bean definitions
This commit restores the user class in generated RootBeanDefinition
instances. Previously the CGLIB subclass was exposed. While this is
important in regular runtime as the configuration class parser operates
on the bean definition, this is not relevant for AOT as this information
is internal and captured in the instance supplier.

Closes gh-33960
2024-12-06 15:34:00 +01:00
Stéphane Nicoll 086d7081f8 Merge branch '6.2.x' 2024-12-05 15:57:57 +01:00
Stéphane Nicoll 81a9f3d50b Restore public type for generated instance supplier of CGLIB proxy
This commit restores the signature of instance suppliers that are
exposing a CGLIB proxy. While calling the CGLIB proxy itself, and
making it available in BeanInstanceSupplier, is needed internally, such
type should not be exposed as it is an internal concern.

This was breaking InstanceSupplier.andThen as it expects the public
type of the bean to be exposed, not it's eventual CGLIB subclass.

Closes gh-33998
2024-12-05 15:48:49 +01:00
Juergen Hoeller 5e939ccb4b Merge branch '6.2.x' 2024-12-04 21:10:30 +01:00
Juergen Hoeller 384dc2a9b8 Consistently use singleton lock for FactoryBean processing
Closes gh-33972
2024-12-04 21:02:30 +01:00
Juergen Hoeller 2b9010c2a2 Remove APIs marked as deprecated for removal
Closes gh-33809
2024-12-04 13:19:39 +01:00
Juergen Hoeller 949432ce8b General upgrade to Jakarta EE 11 APIs
Includes removal of ManagedBean and javax.annotation legacy support.
Includes AbstractJson(Http)MessageConverter revision for Yasson 3.0.
Includes initial Hibernate ORM 7.0 upgrade.

Closes gh-34011
Closes gh-33750
2024-12-03 13:30:25 +01:00
Brian Clozel ba312f6c7c Update AOT support after RuntimeHints changes
This commit adapts AOT support in various modules after the RuntimeHints
and related deprecation changes.

`MemberCategory.INTROSPECT_*` hints are now removed and
`MemberCategory.*_FIELDS` are  replaced with
`MemberCategory.INVOKE*_FIELDS` when invocation is needed.

Usage of `RuntimeHintsAgent` are also deprecated.

Closes gh-33847
2024-11-29 14:44:05 +01:00
Brian Clozel 5fa9460bf6 Temporarily revert changes for gh-33616
See gh-33616
2024-11-28 18:07:23 +01:00
Brian Clozel 5d492689b7 Create MetadataReaderFactory instances with factory methods
Prior to this commit, Spring would create directly
`SimpleMetadataReaderFactory` instances or would manually create
`CachingMetadataReaderFactory` which extend
`SimpleMetadataReaderFactory`. This would prevent usage of the new
`ClassFileMetadataReaderFactory` in our internal codebase.

This commit replaces manual instantiations with calls to
`MetadataReaderFactory` factory methods and makes
`CachingMetadataReaderFactory` delegate to another factory created with
the same factory methods.

This allows internal usage of `ClassFileMetadataReaderFactory`
internally.

Closes gh-33616
2024-11-28 16:30:16 +01:00
Juergen Hoeller 90ef7ac514 Cache singleton results for @Lazy injection points
Includes consistent use of unmodifiable collections.

Closes gh-33841
2024-11-13 13:29:20 +01:00
Sébastien Deleuze 7e1d6fe934 Merge branch '6.1.x' 2024-11-05 10:27:22 +01:00
Johnny Lim 0beb56a58c Fix indentation to use tabs in Kotlin source files
Closes gh-33840
2024-11-05 10:24:02 +01:00
Juergen Hoeller a1dd2e7c96 Merge branch '6.1.x' 2024-10-21 15:39:10 +02:00
Juergen Hoeller e90a2da05d Clarify defensive impact of allowEagerInit flag for type matching
Closes gh-33740
2024-10-21 15:38:25 +02:00
Juergen Hoeller ee1fe8a1e9 Consistently evaluate defaultCandidate flag on constructors and methods
Closes gh-33762
2024-10-21 13:53:28 +02:00
Sam Brannen 68d9e5d81a Merge branch '6.1.x' 2024-10-19 15:03:15 +02:00
Sam Brannen d72c8b32b7 Ignore duplicate @⁠Priority values when determining highest priority
Prior to this commit, DefaultListableBeanFactory's
determineHighestPriorityCandidate() method sometimes failed to
determine the highest priority candidate if duplicate priority
candidates were detected whose priority was not the highest priority in
the candidate set. In addition, the bean registration order affected
the outcome of the algorithm: if the highest priority was detected
before other duplicate priorities were detected, the algorithm
succeeded in determining the highest priority candidate.

This commit addresses those shortcomings by ignoring duplicate
@⁠Priority values unless the duplication is for the highest priority
encountered, in which case a NoUniqueBeanDefinitionException is still
thrown to signal that multiple beans were found with the same "highest
priority".

Closes gh-33733
2024-10-19 14:54:29 +02:00
Sébastien Deleuze effe606b28 Refine record canonical constructor support in BeanUtils
This commit refines the contribution with the following changes:
 - Move the support to findPrimaryConstructor
 - Use a for loop instead of a Stream for more efficiency
 - Support other visibilities than public
 - Polishing

Closes gh-33707
2024-10-16 17:38:47 +02:00
evgenijnikiforov 514d6000d1 Support record canonical constructor in BeanUtils
See gh-33707
2024-10-16 17:38:47 +02:00
Juergen Hoeller fa955934e7 Merge branch '6.1.x'
# Conflicts:
#	spring-beans/src/main/java/org/springframework/beans/factory/annotation/QualifierAnnotationAutowireCandidateResolver.java
2024-10-16 17:19:30 +02:00
Juergen Hoeller fde7116ae4 Consistently skip processing of plain Java annotations
Closes gh-33580
2024-10-16 17:17:22 +02:00
Juergen Hoeller e89218b39a Merge branch '6.1.x' 2024-10-16 13:46:22 +02:00
Juergen Hoeller 11d4272ff4 Use Locale.ROOT consistently for toLower/toUpperCase
Closes gh-33708
2024-10-16 13:36:23 +02:00
Juergen Hoeller fb6a6892ef Merge branch '6.1.x' 2024-10-16 11:36:30 +02:00
Juergen Hoeller feb6a5f52d Polishing 2024-10-16 11:35:23 +02:00
Brian Clozel f204f4962d Document XML parser usage against security false positives
Prior to this commit, our XML parser usage would be already haredened
against XXE (XML External Entities) attacks. Still, we recently received
several invalid security reports claiming that our setup should be
hardened.

This commit documents a few usages of XML parsers to add some more
context and hopefully prevent future invalid reports.

Closes gh-33713
2024-10-15 18:59:02 +02:00
Juergen Hoeller 7ea0ac55cd Restore special instance supplier generation for inner classes
Closes gh-33683
2024-10-11 16:59:15 +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
Yanming Zhou 8941e2876e Replace 'e.g.' with 'for example' in documentation and comments
Closes gh-33515
2024-09-26 14:11:17 +02:00
Sam Brannen 8e85dd0673 Fix error message for XML qualifier 'attribute' tag 2024-09-26 12:11:27 +02:00
Juergen Hoeller 885f650911 Merge branch '6.1.x' 2024-09-25 12:46:37 +02:00
Juergen Hoeller ca0448260f Convert DateTimeException to expected IllegalArgumentException
Closes gh-33545
2024-09-25 12:45:20 +02:00
Juergen Hoeller 5f6b8d5582 Polishing 2024-09-24 18:59:17 +02:00
Juergen Hoeller d6e4bd7c90 Resolve AOT factory method target by bean name and reduce reflective method exposure
Includes consistent withShortcut naming and consistent bean definition flag exposure.
Removes support for inner classes in alignment with standard core container behavior.

Closes gh-32834
2024-09-24 18:59:08 +02:00
Sam Brannen 28dbcb2421 Improve FactoryBean Javadoc 2024-09-23 17:20:19 +02:00