Skip to content

Commit dfdfc03

Browse files
committed
Polishing
1 parent fa138d2 commit dfdfc03

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.util.Collections;
2828
import java.util.HashMap;
2929
import java.util.HashSet;
30+
import java.util.LinkedHashMap;
3031
import java.util.LinkedHashSet;
3132
import java.util.LinkedList;
3233
import java.util.List;
@@ -151,7 +152,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
151152
private boolean hasDestructionAwareBeanPostProcessors;
152153

153154
/** Map from scope identifier String to corresponding Scope */
154-
private final Map<String, Scope> scopes = new HashMap<String, Scope>(8);
155+
private final Map<String, Scope> scopes = new LinkedHashMap<String, Scope>(8);
155156

156157
/** Security context used when running with a SecurityManager */
157158
private SecurityContextProvider securityContextProvider;
@@ -856,11 +857,15 @@ public void registerScope(String scopeName, Scope scope) {
856857
throw new IllegalArgumentException("Cannot replace existing scopes 'singleton' and 'prototype'");
857858
}
858859
Scope previous = this.scopes.put(scopeName, scope);
859-
if (previous != null && logger.isInfoEnabled()) {
860-
logger.info("Replacing scope '" + scopeName + "' from '" + previous + "' to '" + scope);
860+
if (previous != null && previous != scope) {
861+
if (logger.isInfoEnabled()) {
862+
logger.info("Replacing scope '" + scopeName + "' from [" + previous + "] to [" + scope + "]");
863+
}
861864
}
862-
else if (previous == null && logger.isDebugEnabled()) {
863-
logger.debug("Registering scope '" + scopeName + "' with '" + scope + "'");
865+
else {
866+
if (logger.isDebugEnabled()) {
867+
logger.debug("Registering scope '" + scopeName + "' with implementation [" + scope + "]");
868+
}
864869
}
865870
}
866871

spring-core/src/main/java/org/springframework/util/ClassUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ public static boolean isPrimitiveWrapperArray(Class<?> clazz) {
893893
*/
894894
public static Class<?> resolvePrimitiveIfNecessary(Class<?> clazz) {
895895
Assert.notNull(clazz, "Class must not be null");
896-
return (clazz.isPrimitive() && clazz != void.class? primitiveTypeToWrapperMap.get(clazz) : clazz);
896+
return (clazz.isPrimitive() && clazz != void.class ? primitiveTypeToWrapperMap.get(clazz) : clazz);
897897
}
898898

899899
/**

0 commit comments

Comments
 (0)