Merge branch '6.2.x'

This commit is contained in:
Sam Brannen
2025-07-11 15:52:54 +02:00
4 changed files with 8 additions and 8 deletions
@@ -60,7 +60,7 @@ public abstract class AbstractBeanFactoryBasedTargetSource implements TargetSour
protected final transient Log logger = LogFactory.getLog(getClass());
/** Name of the target bean we will create on each invocation. */
private @Nullable String targetBeanName;
protected @Nullable String targetBeanName;
/** Class of the target. */
private volatile @Nullable Class<?> targetClass;
@@ -54,7 +54,7 @@ public abstract class AbstractPrototypeBasedTargetSource extends AbstractBeanFac
if (!beanFactory.isPrototype(getTargetBeanName())) {
throw new BeanDefinitionStoreException(
"Cannot use prototype-based TargetSource against non-prototype bean with name '" +
getTargetBeanName() + "': instances would not be independent");
this.targetBeanName + "': instances would not be independent");
}
}
@@ -64,7 +64,7 @@ public abstract class AbstractPrototypeBasedTargetSource extends AbstractBeanFac
*/
protected Object newPrototypeInstance() throws BeansException {
if (logger.isDebugEnabled()) {
logger.debug("Creating new instance of bean '" + getTargetBeanName() + "'");
logger.debug("Creating new instance of bean '" + this.targetBeanName + "'");
}
return getBeanFactory().getBean(getTargetBeanName());
}
@@ -75,7 +75,7 @@ public abstract class AbstractPrototypeBasedTargetSource extends AbstractBeanFac
*/
protected void destroyPrototypeInstance(Object target) {
if (logger.isDebugEnabled()) {
logger.debug("Destroying instance of bean '" + getTargetBeanName() + "'");
logger.debug("Destroying instance of bean '" + this.targetBeanName + "'");
}
if (getBeanFactory() instanceof ConfigurableBeanFactory cbf) {
cbf.destroyBean(getTargetBeanName(), target);
@@ -85,7 +85,7 @@ public abstract class AbstractPrototypeBasedTargetSource extends AbstractBeanFac
disposableBean.destroy();
}
catch (Throwable ex) {
logger.warn("Destroy method on bean with name '" + getTargetBeanName() + "' threw an exception", ex);
logger.warn("Destroy method on bean with name '" + this.targetBeanName + "' threw an exception", ex);
}
}
}
@@ -54,7 +54,7 @@ public class PrototypeTargetSource extends AbstractPrototypeBasedTargetSource {
@Override
public String toString() {
return "PrototypeTargetSource for target bean with name '" + getTargetBeanName() + "'";
return "PrototypeTargetSource for target bean with name '" + this.targetBeanName + "'";
}
}
@@ -61,7 +61,7 @@ public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource
new NamedThreadLocal<>("Thread-local instance of bean") {
@Override
public String toString() {
return super.toString() + " '" + getTargetBeanName() + "'";
return super.toString() + " '" + targetBeanName + "'";
}
};
@@ -86,7 +86,7 @@ public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource
Object target = this.targetInThread.get();
if (target == null) {
if (logger.isDebugEnabled()) {
logger.debug("No target for prototype '" + getTargetBeanName() + "' bound to thread: " +
logger.debug("No target for prototype '" + this.targetBeanName + "' bound to thread: " +
"creating one and binding it to thread '" + Thread.currentThread().getName() + "'");
}
// Associate target with ThreadLocal.