Commit Graph

2200 Commits

Author SHA1 Message Date
Sam Brannen d0966dfb58 Revise contribution
See gh-34747
2025-04-14 14:15:50 +02:00
lituizi bb45a3ae69 Update AbstractAutowireCapableBeanFactory.ignoreDependencyInterface() Javadoc
Specifically, the documentation update reflects that:

- Initially, it was mentioned that only the `BeanFactoryAware`
  interface is ignored by default.

- The updated documentation now correctly states that `BeanNameAware`,
  `BeanFactoryAware`, and `BeanClassLoaderAware` interfaces are all
  ignored by default.

This change ensures a more accurate representation of the default
behavior regarding which dependency interfaces are automatically
ignored during autowiring in the context of Spring's bean factory
mechanism.

Closes gh-34747

Signed-off-by: lituizi <2811328244@qq.com>
2025-04-14 14:07:35 +02:00
Sam Brannen a22d204681 Remove duplicate words in Java source code
Discovered using regular expression: \b(\w+)\s+\1\b[^(}]
2025-04-14 11:24:55 +02:00
Juergen Hoeller c4f66b776f Use single volatile field for indicating pre-instantiation phase
Backport Bot / build (push) Has been cancelled Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
Deploy Docs / Dispatch docs deployment (push) Has been cancelled Details
Build and Deploy Snapshot / Verify (push) Has been cancelled Details
See gh-34729
2025-04-12 06:00:18 +02:00
Juergen Hoeller 6ea9f66fd7 Remove superfluous DefaultParameterNameDiscoverer configuration
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-04-10 18:33:39 +02:00
Juergen Hoeller eea6addd26 Avoid lenient locking for additional external bootstrap threads
Includes spring.locking.strict revision to differentiate between true, false, not set.
Includes checkFlag accessor on SpringProperties, also used in StatementCreatorUtils.

Closes gh-34729
See gh-34303
2025-04-10 18:33:21 +02:00
Juergen Hoeller 74ab5e4e25 Enforce circular reference exception between more than two threads as well
See gh-34672
2025-04-07 22:37:19 +02:00
Juergen Hoeller 463541967a Enforce circular reference exception between all thread variations
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Closes gh-34672
2025-04-07 17:08:47 +02:00
Sam Brannen dbd47ff4f9 Implement additional micro performance optimizations
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
See gh-34717
2025-04-04 15:51:37 +02:00
Sam Brannen 381bc4c405 Polish contribution
See gh-34717
2025-04-04 15:29:10 +02:00
Olivier Bourgain 0f2308e85f Implement micro performance optimizations
- ClassUtils.isAssignable(): Avoid Map lookup when the type is not a
  primitive.

- AnnotationsScanner: Perform low cost array length check before String
  comparisons.

- BeanFactoryUtils: Use char comparison instead of String comparison.
  The bean factory prefix is '&', so we can use a char comparison
  instead of more heavyweight String.startsWith("&").

- AbstractBeanFactory.getMergedBeanDefinition(): Perform the low cost
  check first. Map lookup, while cheap, is still more expensive than
  instanceof.

Closes gh-34717

Signed-off-by: Olivier Bourgain <olivierbourgain02@gmail.com>
2025-04-04 14:34:55 +02:00
Juergen Hoeller e7db15b325 Perform type check before singleton check for early FactoryBean matching
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Closes gh-34710
2025-04-03 11:59:22 +02:00
Juergen Hoeller 203ca30a64 Include cause in MethodInvocationException message
Closes gh-34691
2025-04-01 22:12:17 +02:00
Juergen Hoeller 34ea0461c7 Polishing 2025-04-01 22:12:09 +02:00
Juergen Hoeller 743f32675d Only attempt load for CGLIB classes in AOT mode
Closes gh-34677
2025-03-31 16:39:18 +02:00
Juergen Hoeller 3ddc607b3e Add spring.locking.strict property to common appendix
See gh-34303
2025-03-31 16:38:28 +02:00
Juergen Hoeller 75e5a75da5 Enforce circular reference exception within non-managed thread
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Closes gh-34672
2025-03-28 20:46:09 +01:00
Juergen Hoeller 9bf01df230 Evaluate lenientLockingAllowed flag per DefaultListableBeanFactory instance
See gh-34303
2025-03-28 20:45:06 +01:00
Stéphane Nicoll 2862c87601 Make sure the generated values are available from a static context
This commit updates the tests of property values code generated to
invoke the generated code from a `static` context. This ensures that
the test fails if that's not the case.

This commit also updated LinkedHashMap handling that did suffer from
that problem.

Closes gh-34659
2025-03-27 12:06:18 +01:00
Juergen Hoeller aa56b5001a Detect late-set primary markers for autowiring shortcut algorithm
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Closes gh-34658
2025-03-26 23:47:42 +01:00
Juergen Hoeller 6905dff660 Introduce spring.locking.strict=true flag for 6.1.x style bean creation locking
Closes gh-34303
2025-03-25 17:08:55 +01:00
Juergen Hoeller 37fb79e8ff Fix qualifier resolution for aliased name against parent factory
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Closes gh-34644
2025-03-25 00:08:42 +01:00
Juergen Hoeller dc41ff569e Add javadoc notes on potential exception suppression in getBeansOfType
Closes gh-34629
2025-03-21 15:52:42 +01:00
Juergen Hoeller 47651350f3 Polishing
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-03-21 10:58:40 +01:00
Sam Brannen 208d52d852 Introduce Checkstyle rule for separator symbol location 2025-03-19 15:35:44 +01:00
Juergen Hoeller ad949a7450 Add includeNonSingletons flag for ObjectProvider stream access
Closes gh-34591
2025-03-18 16:10:30 +01:00
Juergen Hoeller 911cdb2ad0 Add resolveAutowireCandidates variant with includeNonSingletons and allowEagerInit
Closes gh-34591
2025-03-13 18:48:43 +01:00
Juergen Hoeller 143985e862 Add tests for primary/fallback/defaultCandidate precedence
Closes gh-34449
2025-03-08 12:22:14 +01:00
Juergen Hoeller 4bd280b87e Explain availability and uniqueness (including primary/fallback/default) in javadoc
Closes gh-34447
2025-03-08 12:22:04 +01:00
Juergen Hoeller f3b50c9a58 Ignore null beans in SimpleAutowireCandidateResolver.resolveAutowireCandidates
Closes gh-34543
2025-03-05 22:44:09 +01:00
Juergen Hoeller 403362fe3c Polishing 2025-03-04 18:44:56 +01:00
Juergen Hoeller d2733cea36 Notify lenientCreationFinished condition after locked creation as well
Closes gh-34522
2025-03-01 22:20:23 +01:00
Juergen Hoeller e230ea537c Consistently resolve unique default candidate bean
Closes gh-34432
2025-02-18 13:11:36 +01:00
Juergen Hoeller 94eb6006e8 Leniently accept same singleton instance if implicitly appeared
Closes gh-34427
2025-02-18 13:01:08 +01:00
Juergen Hoeller dfc10c1a8d Wait for lenient bean creation in non-locked threads as well
Closes gh-34349
2025-02-12 23:06:22 +01:00
Juergen Hoeller b336bbe539 Wait for lenient bean creation in locked thread when necessary
Closes gh-34349
2025-02-12 12:17:02 +01:00
Juergen Hoeller ace2f0a3e5 Expose resolveAutowireCandidates method with basic candidate filtering
DependencyObjectProvider is aligned to check basic autowire-candidate status even in case of custom filtering.

Closes gh-34203
2025-02-07 19:00:25 +01:00
Stéphane Nicoll ec037b1ec0 Polish "Add support for multidimensional arrays"
See gh-34183
2025-02-05 14:35:33 +01:00
xumengqi 68c1e2ac92 Add support for multidimensional arrays
See gh-34183
2025-02-05 14:23:09 +01:00
Juergen Hoeller cda7e98643 Lazily override default editors when actually needed
Closes gh-34361
2025-02-04 13:26:16 +01:00
Juergen Hoeller 8c2b44bd6c Support filtered/unfiltered stream access on ObjectProvider
Closes gh-34318
Closes gh-34203
2025-02-03 15:04:27 +01:00
Juergen Hoeller 323e52b5a9 Continue with pre-instantiation when current bean is in creation already
Closes gh-34349
2025-01-31 15:16:52 +01:00
Sam Brannen 53afe27109 Clean up warnings in Gradle build
See gh-34332
2025-01-29 17:52:27 +01:00
Sam Brannen b9e43d05bd Restore property binding support for a Map that implements Iterable
The changes in commit c20a2e4763 introduced a regression with regard to
binding to a Map property when the Map also happens to implement
Iterable.

Although that is perhaps not a very common scenario, this commit
reorders the if-blocks in AbstractNestablePropertyAccessor's
getPropertyValue(PropertyTokenHolder) method so that a Map is
considered before an Iterable, thereby allowing an Iterable-Map to be
accessed as a Map.

See gh-907
Closes gh-34332
2025-01-29 17:34:47 +01:00
Juergen Hoeller 467d5f3ca3 Try late locking for waiting on specific bean to be finished
Closes gh-34186
2025-01-13 17:48:13 +01:00
Juergen Hoeller 8771b9ea21 Defensively acquire singleton lock for FactoryBean type check
Closes gh-34247
2025-01-13 13:04:42 +01:00
Juergen Hoeller ff72652890 Defensively check expected type for qualified bean
Closes gh-34187
2025-01-13 13:03:25 +01:00
luozongle01 a942362221 Fix a typo
Closes gh-34101
2024-12-17 11:40:47 +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 66da5d7ab9 Restore original override behavior when override allowed
Closes gh-33920
2024-12-10 16:25:49 +01:00