Evaluate lenientLockingAllowed flag per DefaultListableBeanFactory instance
See gh-34303
This commit is contained in:
parent
8d2166139f
commit
9bf01df230
|
|
@ -138,8 +138,6 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
|||
*/
|
||||
public static final String STRICT_LOCKING_PROPERTY_NAME = "spring.locking.strict";
|
||||
|
||||
private static final boolean lenientLockingAllowed = !SpringProperties.getFlag(STRICT_LOCKING_PROPERTY_NAME);
|
||||
|
||||
@Nullable
|
||||
private static Class<?> jakartaInjectProviderClass;
|
||||
|
||||
|
|
@ -159,6 +157,9 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
|||
private static final Map<String, Reference<DefaultListableBeanFactory>> serializableFactories =
|
||||
new ConcurrentHashMap<>(8);
|
||||
|
||||
/** Whether lenient locking is allowed in this factory. */
|
||||
private final boolean lenientLockingAllowed = !SpringProperties.getFlag(STRICT_LOCKING_PROPERTY_NAME);
|
||||
|
||||
/** Optional id for this factory, for serialization purposes. */
|
||||
@Nullable
|
||||
private String serializationId;
|
||||
|
|
@ -1051,7 +1052,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
|||
@Override
|
||||
@Nullable
|
||||
protected Boolean isCurrentThreadAllowedToHoldSingletonLock() {
|
||||
return (lenientLockingAllowed && this.preInstantiationPhase ?
|
||||
return (this.lenientLockingAllowed && this.preInstantiationPhase ?
|
||||
this.preInstantiationThread.get() != PreInstantiation.BACKGROUND : null);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue