|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2018 the original author or authors. |
| 2 | + * Copyright 2002-2019 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -133,7 +133,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
133 | 133 |
|
134 | 134 | private final Set<String> targetSourcedBeans = Collections.newSetFromMap(new ConcurrentHashMap<>(16));
|
135 | 135 |
|
136 |
| - private final Set<Object> earlyProxyReferences = Collections.newSetFromMap(new ConcurrentHashMap<>(16)); |
| 136 | + private final Map<Object, Object> earlyProxyReferences = new ConcurrentHashMap<>(16); |
137 | 137 |
|
138 | 138 | private final Map<Object, Class<?>> proxyTypes = new ConcurrentHashMap<>(16);
|
139 | 139 |
|
@@ -236,9 +236,7 @@ public Constructor<?>[] determineCandidateConstructors(Class<?> beanClass, Strin
|
236 | 236 | @Override
|
237 | 237 | public Object getEarlyBeanReference(Object bean, String beanName) {
|
238 | 238 | Object cacheKey = getCacheKey(bean.getClass(), beanName);
|
239 |
| - if (!this.earlyProxyReferences.contains(cacheKey)) { |
240 |
| - this.earlyProxyReferences.add(cacheKey); |
241 |
| - } |
| 239 | + this.earlyProxyReferences.put(cacheKey, bean); |
242 | 240 | return wrapIfNecessary(bean, beanName, cacheKey);
|
243 | 241 | }
|
244 | 242 |
|
@@ -297,7 +295,7 @@ public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
297 | 295 | public Object postProcessAfterInitialization(@Nullable Object bean, String beanName) {
|
298 | 296 | if (bean != null) {
|
299 | 297 | Object cacheKey = getCacheKey(bean.getClass(), beanName);
|
300 |
| - if (!this.earlyProxyReferences.contains(cacheKey)) { |
| 298 | + if (this.earlyProxyReferences.remove(cacheKey) != bean) { |
301 | 299 | return wrapIfNecessary(bean, beanName, cacheKey);
|
302 | 300 | }
|
303 | 301 | }
|
|
0 commit comments