Improve logging of registerScope

Issue: SPR-12519
This commit is contained in:
Stephane Nicoll 2014-12-22 18:02:26 +01:00
parent aafdcecf53
commit 6d6cd56d4a
1 changed files with 7 additions and 1 deletions

View File

@ -855,7 +855,13 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
if (SCOPE_SINGLETON.equals(scopeName) || SCOPE_PROTOTYPE.equals(scopeName)) {
throw new IllegalArgumentException("Cannot replace existing scopes 'singleton' and 'prototype'");
}
this.scopes.put(scopeName, scope);
Scope previous = this.scopes.put(scopeName, scope);
if (previous != null && logger.isInfoEnabled()) {
logger.info("Replacing scope '" + scopeName + "' from '" + previous + "' to '" + scope);
}
else if (previous == null && logger.isDebugEnabled()) {
logger.debug("Registering scope '" + scopeName + "' with '" + scope + "'");
}
}
@Override