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