Class ConcurrentMapCacheFactoryBean
java.lang.Object
org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.FactoryBean<ConcurrentMapCache>
,org.springframework.beans.factory.InitializingBean
public class ConcurrentMapCacheFactoryBean
extends Object
implements org.springframework.beans.factory.FactoryBean<ConcurrentMapCache>, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean
FactoryBean
for easy configuration of a ConcurrentMapCache
when used within a Spring container. Can be configured through bean properties;
uses the assigned Spring bean name as the default cache name.
Useful for testing or simple caching scenarios, typically in combination
with SimpleCacheManager
or
dynamically through ConcurrentMapCacheManager
.
- Since:
- 3.1
- Author:
- Costin Leau, Juergen Hoeller
-
Field Summary
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Class<?>
boolean
void
setAllowNullValues
(boolean allowNullValues) Set whether to allownull
values (adapting them to an internal null holder value).void
setBeanName
(String beanName) void
Specify the name of the cache.void
setStore
(ConcurrentMap<Object, Object> store) Specify the ConcurrentMap to use as an internal store (possibly pre-populated).
-
Constructor Details
-
ConcurrentMapCacheFactoryBean
public ConcurrentMapCacheFactoryBean()
-
-
Method Details
-
setName
Specify the name of the cache.Default is "" (empty String).
-
setStore
Specify the ConcurrentMap to use as an internal store (possibly pre-populated).Default is a standard
ConcurrentHashMap
. -
setAllowNullValues
public void setAllowNullValues(boolean allowNullValues) Set whether to allownull
values (adapting them to an internal null holder value).Default is "true".
-
setBeanName
- Specified by:
setBeanName
in interfaceorg.springframework.beans.factory.BeanNameAware
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
getObject
- Specified by:
getObject
in interfaceorg.springframework.beans.factory.FactoryBean<ConcurrentMapCache>
-
getObjectType
- Specified by:
getObjectType
in interfaceorg.springframework.beans.factory.FactoryBean<ConcurrentMapCache>
-
isSingleton
public boolean isSingleton()- Specified by:
isSingleton
in interfaceorg.springframework.beans.factory.FactoryBean<ConcurrentMapCache>
-