Repository navigation
fix: Offer and resolve @Qualifier bean names by the type of a covariant @Bean override (#680) - #696
Merged
Merged
Conversation
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
#594 (#681) types a superclass
@Beanmethod that a@Configurationsubclass overrides with a narrower return type by the override, as Spring does.@Qualifiercompletion and references still read the raw superclass method, so forcompletion did not offer
animaland the qualifier did not resolve, although the autowiring inspection finds the bean. Gap 1 of #680.Change
SpringBeanService.getBeanCandidatesmatches factory beans by the effective factory method (the override, when there is one) and maps the matches back to the@Beandeclaration, which keeps supplying the name, qualifiers and@Primary; the reference still resolves to the@Beandeclaration. A bean that is not overridden is unchanged.SpringSearchService.getComponentBeanFactories, same tracker, no new lock), andBeanFactoryMethods.overrideInreturns at once for a factory declared in the configuration class itself, so completion and resolve do not walk class hierarchies.Not in this PR (remaining #680 gaps)
NativeSearchService.getBeanPsiMethods,findInArray) — not reachable in light test fixtures.@Configuration— need a probe first.Verification
animaland the qualifier resolves for aDoginjection point — both failed; controls (Animalinjection point, a base that already returnsDog) passed.overrideIndoes not search the hierarchy of the declaring configuration (a throwing decoy class) — both failed in both twins.BeanFactoryMethodsTest27 + 26,CovariantOverrideQualifierReferenceTest6 + 6,ScopedBeanInjectionResolverTest,SpringBeanIncorrectAutowiringInspectionTestand allSpringBeanLineMarkerProvider*twins: 465 tests, 0 failures.:spring-bootstrap:test --rerun-taskson 605a6ff, fresh JUnit XML): spring-core 2407, spring-web 905 (6 skipped), spring-ai 776, spring-data 140, jpa 138, base 35, aop 6, security 6, initializr 5; 0 failures, 0 errors.Main only:
BeanFactoryMethods.overrideIncame with #681.Refs #680