|
27 | 27 | import java.util.Collections;
|
28 | 28 | import java.util.HashMap;
|
29 | 29 | import java.util.HashSet;
|
| 30 | +import java.util.LinkedHashMap; |
30 | 31 | import java.util.LinkedHashSet;
|
31 | 32 | import java.util.LinkedList;
|
32 | 33 | import java.util.List;
|
@@ -151,7 +152,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
151 | 152 | private boolean hasDestructionAwareBeanPostProcessors;
|
152 | 153 |
|
153 | 154 | /** 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); |
155 | 156 |
|
156 | 157 | /** Security context used when running with a SecurityManager */
|
157 | 158 | private SecurityContextProvider securityContextProvider;
|
@@ -856,11 +857,15 @@ public void registerScope(String scopeName, Scope scope) {
|
856 | 857 | throw new IllegalArgumentException("Cannot replace existing scopes 'singleton' and 'prototype'");
|
857 | 858 | }
|
858 | 859 | 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 | + } |
861 | 864 | }
|
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 | + } |
864 | 869 | }
|
865 | 870 | }
|
866 | 871 |
|
|
0 commit comments