class AnnotationDrivenCacheBeanDefinitionParser extends java.lang.Object implements BeanDefinitionParser
BeanDefinitionParser
implementation that allows users to easily configure all the
infrastructure beans required to enable annotation-driven cache
demarcation.
By default, all proxies are created as JDK proxies. This may cause
some problems if you are injecting objects as concrete classes rather
than interfaces. To overcome this restriction you can set the
'proxy-target-class
' attribute to 'true
', which will
result in class-based proxies being created.
If the JSR-107 API and Spring's JCache implementation are present,
the necessary infrastructure beans required to handle methods annotated
with CacheResult
, CachePut
, CacheRemove
or
CacheRemoveAll
are also registered.
Modifier and Type | Class and Description |
---|---|
private static class |
AnnotationDrivenCacheBeanDefinitionParser.JCacheCachingConfigurer
Configure the necessary infrastructure to support the standard JSR-107 caching annotations.
|
private static class |
AnnotationDrivenCacheBeanDefinitionParser.SpringCachingConfigurer
Configure the necessary infrastructure to support the Spring's caching annotations.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
CACHE_ASPECT_CLASS_NAME |
private static java.lang.String |
JCACHE_ASPECT_CLASS_NAME |
private static boolean |
jCacheImplPresent |
private static boolean |
jsr107Present |
Constructor and Description |
---|
AnnotationDrivenCacheBeanDefinitionParser() |
Modifier and Type | Method and Description |
---|---|
BeanDefinition |
parse(org.w3c.dom.Element element,
ParserContext parserContext)
Parses the '
<cache:annotation-driven> ' tag. |
private static void |
parseCacheResolution(org.w3c.dom.Element element,
BeanDefinition def,
boolean setBoth)
Parse the cache resolution strategy to use.
|
private static BeanDefinition |
parseErrorHandler(org.w3c.dom.Element element,
BeanDefinition def) |
private void |
registerCacheAdvisor(org.w3c.dom.Element element,
ParserContext parserContext) |
private void |
registerCacheAspect(org.w3c.dom.Element element,
ParserContext parserContext) |
private static final java.lang.String CACHE_ASPECT_CLASS_NAME
private static final java.lang.String JCACHE_ASPECT_CLASS_NAME
private static final boolean jsr107Present
private static final boolean jCacheImplPresent
AnnotationDrivenCacheBeanDefinitionParser()
public BeanDefinition parse(org.w3c.dom.Element element, ParserContext parserContext)
<cache:annotation-driven>
' tag. Will
register an AutoProxyCreator
with the container as necessary.parse
in interface BeanDefinitionParser
element
- the element that is to be parsed into one or more BeanDefinitions
parserContext
- the object encapsulating the current state of the parsing process;
provides access to a BeanDefinitionRegistry
BeanDefinition
private void registerCacheAspect(org.w3c.dom.Element element, ParserContext parserContext)
private void registerCacheAdvisor(org.w3c.dom.Element element, ParserContext parserContext)
private static void parseCacheResolution(org.w3c.dom.Element element, BeanDefinition def, boolean setBoth)
setBoth
is true
, both service are actually injected.private static BeanDefinition parseErrorHandler(org.w3c.dom.Element element, BeanDefinition def)