Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
79ed87e3
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
79ed87e3
编写于
7月 22, 2011
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
updated cache aspect after CacheAspectSupport base class changes
上级
df3761e3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
13 deletion
+16
-13
org.springframework.aspects/src/main/java/org/springframework/cache/aspectj/AbstractCacheAspect.aj
.../org/springframework/cache/aspectj/AbstractCacheAspect.aj
+8
-6
org.springframework.aspects/src/main/java/org/springframework/cache/aspectj/AnnotationCacheAspect.aj
...rg/springframework/cache/aspectj/AnnotationCacheAspect.aj
+7
-6
org.springframework.aspects/src/test/java/org/springframework/cache/config/annotation-cache-aspectj.xml
...springframework/cache/config/annotation-cache-aspectj.xml
+1
-1
未找到文件。
org.springframework.aspects/src/main/java/org/springframework/cache/aspectj/AbstractCacheAspect.aj
浏览文件 @
79ed87e3
/*
*
Copyright
20
10
the
original
author
or
authors
.
*
Copyright
20
02
-
2011
the
original
author
or
authors
.
*
*
Licensed
under
the
Apache
License
,
Version
2.0
(
the
"License"
);
*
you
may
not
use
this
file
except
in
compliance
with
the
License
.
...
...
@@ -36,8 +36,9 @@ import org.springframework.cache.interceptor.CacheOperationSource;
*
<
p
><
b
>
NB
:</
b
>
If
a
method
implements
an
interface
that
is
itself
*
cache
annotated
,
the
relevant
Spring
cache
definition
*
will
<
i
>
not
</
i
>
be
resolved
.
*
*
@
author
Costin
Leau
*
@
since
3.1
*/
public
abstract
aspect
AbstractCacheAspect
extends
CacheAspectSupport
{
...
...
@@ -50,7 +51,7 @@ public abstract aspect AbstractCacheAspect extends CacheAspectSupport {
*
cache
metadata
for
each
joinpoint
.
*/
protected
AbstractCacheAspect
(
CacheOperationSource
...
cos
)
{
setCache
Defini
tionSources
(
cos
);
setCache
Opera
tionSources
(
cos
);
}
@
SuppressAjWarnings
(
"adviceDidNotMatch"
)
...
...
@@ -59,7 +60,6 @@ public abstract aspect AbstractCacheAspect extends CacheAspectSupport {
Method
method
=
methodSignature
.
getMethod
();
Callable
<
Object
>
ajInvocation
=
new
Callable
<
Object
>()
{
public
Object
call
()
{
return
proceed
(
cachedObject
);
}
...
...
@@ -67,7 +67,8 @@ public abstract aspect AbstractCacheAspect extends CacheAspectSupport {
try
{
return
execute
(
ajInvocation
,
thisJoinPoint
.
getTarget
(),
method
,
thisJoinPoint
.
getArgs
());
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
UnsupportedOperationException
(
"Should not throw exception"
,
ex
);
}
}
...
...
@@ -78,4 +79,5 @@ public abstract aspect AbstractCacheAspect extends CacheAspectSupport {
*
will
be
retrieved
using
Spring
's {@link CacheOperationSource} interface.
*/
protected abstract pointcut cacheMethodExecution(Object cachedObject);
}
\ No newline at end of file
}
org.springframework.aspects/src/main/java/org/springframework/cache/aspectj/AnnotationCacheAspect.aj
浏览文件 @
79ed87e3
/*
*
Copyright
20
10
the
original
author
or
authors
.
*
Copyright
20
02
-
2011
the
original
author
or
authors
.
*
*
Licensed
under
the
Apache
License
,
Version
2.0
(
the
"License"
);
*
you
may
not
use
this
file
except
in
compliance
with
the
License
.
...
...
@@ -21,9 +21,8 @@ import org.springframework.cache.annotation.CacheEvict;
import
org
.
springframework
.
cache
.
annotation
.
Cacheable
;
/**
*
Concrete
AspectJ
cache
aspect
using
Spring
{@
link
Cacheable
}
annotation
*
for
JDK
1.5
+.
*
*
Concrete
AspectJ
cache
aspect
using
Spring
's {@link Cacheable} annotation.
*
* <p>When using this aspect, you <i>must</i> annotate the implementation class
* (and/or methods within that class), <i>not</i> the interface (if any) that
* the class implements. AspectJ follows Java'
s
rule
that
annotations
on
...
...
@@ -37,8 +36,9 @@ import org.springframework.cache.annotation.Cacheable;
*
Any
method
may
be
annotated
(
regardless
of
visibility
).
*
Annotating
non
-
public
methods
directly
is
the
only
way
*
to
get
caching
demarcation
for
the
execution
of
such
operations
.
*
*
*
@
author
Costin
Leau
*
@
since
3.1
*/
public
aspect
AnnotationCacheAspect
extends
AbstractCacheAspect
{
...
...
@@ -83,4 +83,5 @@ public aspect AnnotationCacheAspect extends AbstractCacheAspect {
(
executionOfAnyPublicMethodInAtCacheableType
()
||
executionOfAnyPublicMethodInAtCacheEvictType
()
||
executionOfCacheableMethod
()
||
executionOfCacheEvictMethod
())
&&
this
(
cachedObject
);
}
\ No newline at end of file
}
org.springframework.aspects/src/test/java/org/springframework/cache/config/annotation-cache-aspectj.xml
浏览文件 @
79ed87e3
...
...
@@ -13,7 +13,7 @@
<bean
id=
"cacheAspect"
class=
"org.springframework.cache.aspectj.AnnotationCacheAspect"
factory-method=
"aspectOf"
>
<property
name=
"cacheManager"
ref=
"cacheManager"
/>
<property
name=
"cache
DefinitionSources
"
ref=
"annotationSource"
/>
<property
name=
"cache
OperationSource
"
ref=
"annotationSource"
/>
</bean>
<bean
id=
"cacheManager"
class=
"org.springframework.cache.support.SimpleCacheManager"
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录