Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
2d525901
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,发现更多精彩内容 >>
提交
2d525901
编写于
2月 01, 2010
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
proxies with AspectJ pointcuts are fully serializable within a BeanFactory now (SPR-6681)
上级
dcf02445
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
60 addition
and
33 deletion
+60
-33
org.springframework.aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java
...pringframework/aop/aspectj/AspectJExpressionPointcut.java
+40
-29
org.springframework.aop/src/main/java/org/springframework/aop/support/AbstractBeanFactoryPointcutAdvisor.java
...ework/aop/support/AbstractBeanFactoryPointcutAdvisor.java
+20
-4
未找到文件。
org.springframework.aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java
浏览文件 @
2d525901
...
...
@@ -16,6 +16,8 @@
package
org.springframework.aop.aspectj
;
import
java.io.IOException
;
import
java.io.ObjectInputStream
;
import
java.lang.reflect.Method
;
import
java.util.HashSet
;
import
java.util.Map
;
...
...
@@ -75,27 +77,29 @@ import org.springframework.util.StringUtils;
public
class
AspectJExpressionPointcut
extends
AbstractExpressionPointcut
implements
ClassFilter
,
IntroductionAwareMethodMatcher
,
BeanFactoryAware
{
private
static
final
Set
<
PointcutPrimitive
>
DEFAULT_
SUPPORTED_PRIMITIVES
=
new
HashSet
<
PointcutPrimitive
>();
private
static
final
Set
<
PointcutPrimitive
>
SUPPORTED_PRIMITIVES
=
new
HashSet
<
PointcutPrimitive
>();
static
{
DEFAULT_
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
EXECUTION
);
DEFAULT_
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
ARGS
);
DEFAULT_
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
REFERENCE
);
DEFAULT_
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
THIS
);
DEFAULT_
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
TARGET
);
DEFAULT_
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
WITHIN
);
DEFAULT_
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
AT_ANNOTATION
);
DEFAULT_
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
AT_WITHIN
);
DEFAULT_
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
AT_ARGS
);
DEFAULT_
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
AT_TARGET
);
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
EXECUTION
);
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
ARGS
);
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
REFERENCE
);
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
THIS
);
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
TARGET
);
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
WITHIN
);
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
AT_ANNOTATION
);
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
AT_WITHIN
);
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
AT_ARGS
);
SUPPORTED_PRIMITIVES
.
add
(
PointcutPrimitive
.
AT_TARGET
);
}
private
static
final
Log
logger
=
LogFactory
.
getLog
(
AspectJExpressionPointcut
.
class
);
private
final
Map
<
Method
,
ShadowMatch
>
shadowMatchCache
=
new
ConcurrentHashMap
<
Method
,
ShadowMatch
>(
32
)
;
private
transient
PointcutParser
pointcutParser
;
private
PointcutParser
pointcutParser
;
private
transient
PointcutExpression
pointcutExpression
;
private
transient
Map
<
Method
,
ShadowMatch
>
shadowMatchCache
=
new
ConcurrentHashMap
<
Method
,
ShadowMatch
>(
32
);
private
Class
pointcutDeclarationScope
;
...
...
@@ -105,26 +109,12 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
private
BeanFactory
beanFactory
;
private
PointcutExpression
pointcutExpression
;
/**
* Create a new default AspectJExpressionPointcut.
*/
public
AspectJExpressionPointcut
()
{
this
(
DEFAULT_SUPPORTED_PRIMITIVES
);
}
/**
* Create a new AspectJExpressionPointcut with the given supported primitives.
* @param supportedPrimitives Set of {@link org.aspectj.weaver.tools.PointcutPrimitive}
* instances
*/
public
AspectJExpressionPointcut
(
Set
supportedPrimitives
)
{
this
.
pointcutParser
=
PointcutParser
.
getPointcutParserSupportingSpecifiedPrimitivesAndUsingContextClassloaderForResolution
(
supportedPrimitives
);
this
.
pointcutParser
.
registerPointcutDesignatorHandler
(
new
BeanNamePointcutDesignatorHandler
());
initializePointcutParser
();
}
/**
...
...
@@ -134,7 +124,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
* @param paramTypes the parameter types for the pointcut
*/
public
AspectJExpressionPointcut
(
Class
declarationScope
,
String
[]
paramNames
,
Class
[]
paramTypes
)
{
this
(
DEFAULT_SUPPORTED_PRIMITIVES
);
initializePointcutParser
(
);
this
.
pointcutDeclarationScope
=
declarationScope
;
if
(
paramNames
.
length
!=
paramTypes
.
length
)
{
throw
new
IllegalStateException
(
...
...
@@ -144,6 +134,13 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
this
.
pointcutParameterTypes
=
paramTypes
;
}
private
void
initializePointcutParser
()
{
this
.
pointcutParser
=
PointcutParser
.
getPointcutParserSupportingSpecifiedPrimitivesAndUsingContextClassloaderForResolution
(
SUPPORTED_PRIMITIVES
);
this
.
pointcutParser
.
registerPointcutDesignatorHandler
(
new
BeanNamePointcutDesignatorHandler
());
}
/**
* Set the declaration scope for the pointcut.
...
...
@@ -528,4 +525,18 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
}
}
//---------------------------------------------------------------------
// Serialization support
//---------------------------------------------------------------------
private
void
readObject
(
ObjectInputStream
ois
)
throws
IOException
,
ClassNotFoundException
{
// Rely on default serialization, just initialize state after deserialization.
ois
.
defaultReadObject
();
// Initialize transient fields.
initializePointcutParser
();
this
.
shadowMatchCache
=
new
ConcurrentHashMap
<
Method
,
ShadowMatch
>(
32
);
}
}
org.springframework.aop/src/main/java/org/springframework/aop/support/AbstractBeanFactoryPointcutAdvisor.java
浏览文件 @
2d525901
/*
* Copyright 2002-20
07
the original author or authors.
* Copyright 2002-20
10
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.
...
...
@@ -16,6 +16,9 @@
package
org.springframework.aop.support
;
import
java.io.IOException
;
import
java.io.ObjectInputStream
;
import
org.aopalliance.aop.Advice
;
import
org.springframework.beans.factory.BeanFactory
;
...
...
@@ -41,9 +44,9 @@ public abstract class AbstractBeanFactoryPointcutAdvisor extends AbstractPointcu
private
BeanFactory
beanFactory
;
private
Advice
advice
;
private
transient
Advice
advice
;
private
final
Object
adviceMonitor
=
new
Object
();
private
transient
volatile
Object
adviceMonitor
=
new
Object
();
/**
...
...
@@ -74,7 +77,7 @@ public abstract class AbstractBeanFactoryPointcutAdvisor extends AbstractPointcu
synchronized
(
this
.
adviceMonitor
)
{
if
(
this
.
advice
==
null
&&
this
.
adviceBeanName
!=
null
)
{
Assert
.
state
(
this
.
beanFactory
!=
null
,
"BeanFactory must be set to resolve 'adviceBeanName'"
);
this
.
advice
=
(
Advice
)
this
.
beanFactory
.
getBean
(
this
.
adviceBeanName
,
Advice
.
class
);
this
.
advice
=
this
.
beanFactory
.
getBean
(
this
.
adviceBeanName
,
Advice
.
class
);
}
return
this
.
advice
;
}
...
...
@@ -85,4 +88,17 @@ public abstract class AbstractBeanFactoryPointcutAdvisor extends AbstractPointcu
return
getClass
().
getName
()
+
": advice bean '"
+
getAdviceBeanName
()
+
"'"
;
}
//---------------------------------------------------------------------
// Serialization support
//---------------------------------------------------------------------
private
void
readObject
(
ObjectInputStream
ois
)
throws
IOException
,
ClassNotFoundException
{
// Rely on default serialization, just initialize state after deserialization.
ois
.
defaultReadObject
();
// Initialize transient fields.
this
.
adviceMonitor
=
new
Object
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录