|
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.
|
@@ -130,8 +130,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
130 | 130 | private final Set<String> targetSourcedBeans =
|
131 | 131 | Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(16));
|
132 | 132 |
|
133 |
| - private final Set<Object> earlyProxyReferences = |
134 |
| - Collections.newSetFromMap(new ConcurrentHashMap<Object, Boolean>(16)); |
| 133 | + private final Map<Object, Object> earlyProxyReferences = new ConcurrentHashMap<Object, Object>(16); |
135 | 134 |
|
136 | 135 | private final Map<Object, Class<?>> proxyTypes = new ConcurrentHashMap<Object, Class<?>>(16);
|
137 | 136 |
|
@@ -231,9 +230,7 @@ public Constructor<?>[] determineCandidateConstructors(Class<?> beanClass, Strin
|
231 | 230 | @Override
|
232 | 231 | public Object getEarlyBeanReference(Object bean, String beanName) throws BeansException {
|
233 | 232 | Object cacheKey = getCacheKey(bean.getClass(), beanName);
|
234 |
| - if (!this.earlyProxyReferences.contains(cacheKey)) { |
235 |
| - this.earlyProxyReferences.add(cacheKey); |
236 |
| - } |
| 233 | + this.earlyProxyReferences.put(cacheKey, bean); |
237 | 234 | return wrapIfNecessary(bean, beanName, cacheKey);
|
238 | 235 | }
|
239 | 236 |
|
@@ -294,7 +291,7 @@ public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
294 | 291 | public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
295 | 292 | if (bean != null) {
|
296 | 293 | Object cacheKey = getCacheKey(bean.getClass(), beanName);
|
297 |
| - if (!this.earlyProxyReferences.contains(cacheKey)) { |
| 294 | + if (this.earlyProxyReferences.remove(cacheKey) != bean) { |
298 | 295 | return wrapIfNecessary(bean, beanName, cacheKey);
|
299 | 296 | }
|
300 | 297 | }
|
|
0 commit comments