DATACMNS-1415 - Use thread-safe caching in SpelAwareProxyProjectionFactory.
We now use ConcurrentHashMap as type instead of HashMap to properly synchronize concurrent updates to missing cache elements. The previously used HashMap was not thread-safe so concurrent modifications resulted in ConcurrentModificationException.
This commit is contained in:
@@ -17,8 +17,8 @@ package org.springframework.data.projection;
|
||||
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.springframework.beans.BeansException;
|
||||
@@ -44,7 +44,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
*/
|
||||
public class SpelAwareProxyProjectionFactory extends ProxyProjectionFactory implements BeanFactoryAware {
|
||||
|
||||
private final Map<Class<?>, Boolean> typeCache = new HashMap<>();
|
||||
private final Map<Class<?>, Boolean> typeCache = new ConcurrentHashMap<>();
|
||||
private final SpelExpressionParser parser = new SpelExpressionParser();
|
||||
|
||||
private @Nullable BeanFactory beanFactory;
|
||||
|
||||
Reference in New Issue
Block a user