mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-10-10 17:29:17 +00:00
35626: defaultCandidate for scoped proxies
Signed-off-by: Schäfer, H.H. (Hans Hosea) <HansHosea.Schaefer@ing.de>
This commit is contained in:
committed by
Juergen Hoeller
parent
05814f7a42
commit
df67c1cf2d
@@ -83,11 +83,15 @@ public abstract class ScopedProxyUtils {
|
||||
proxyDefinition.setPrimary(targetDefinition.isPrimary());
|
||||
if (targetDefinition instanceof AbstractBeanDefinition abd) {
|
||||
proxyDefinition.copyQualifiersFrom(abd);
|
||||
proxyDefinition.setDefaultCandidate(abd.isDefaultCandidate());
|
||||
}
|
||||
|
||||
// The target bean should be ignored in favor of the scoped proxy.
|
||||
targetDefinition.setAutowireCandidate(false);
|
||||
targetDefinition.setPrimary(false);
|
||||
if (targetDefinition instanceof AbstractBeanDefinition abd) {
|
||||
abd.setDefaultCandidate(false);
|
||||
}
|
||||
|
||||
// Register the target bean as separate bean in the factory.
|
||||
registry.registerBeanDefinition(targetBeanName, targetDefinition);
|
||||
|
||||
Reference in New Issue
Block a user