Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
c7100f77
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,体验更适合开发者的 AI 搜索 >>
提交
c7100f77
编写于
10月 22, 2017
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Explicit notes on advice mode proxy vs aspectj
Issue: SPR-16092
上级
75ec973b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
84 addition
and
34 deletion
+84
-34
spring-context/src/main/java/org/springframework/cache/annotation/EnableCaching.java
...a/org/springframework/cache/annotation/EnableCaching.java
+20
-11
spring-context/src/main/java/org/springframework/scheduling/annotation/EnableAsync.java
...rg/springframework/scheduling/annotation/EnableAsync.java
+19
-11
spring-tx/src/main/java/org/springframework/transaction/annotation/EnableTransactionManagement.java
...k/transaction/annotation/EnableTransactionManagement.java
+19
-10
src/docs/asciidoc/data-access.adoc
src/docs/asciidoc/data-access.adoc
+8
-0
src/docs/asciidoc/integration.adoc
src/docs/asciidoc/integration.adoc
+18
-2
未找到文件。
spring-context/src/main/java/org/springframework/cache/annotation/EnableCaching.java
浏览文件 @
c7100f77
/*
* Copyright 2002-201
6
the original author or authors.
* Copyright 2002-201
7
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.
...
...
@@ -148,15 +148,19 @@ import org.springframework.core.Ordered;
* can be useful if you do not need to customize everything. See {@link CachingConfigurer}
* Javadoc for further details.
*
* <p>The {@link #mode()} attribute controls how advice is applied; if the mode is
* {@link AdviceMode#PROXY} (the default), then the other attributes such as
* {@link #proxyTargetClass()} control the behavior of the proxying.
* <p>The {@link #mode} attribute controls how advice is applied: If the mode is
* {@link AdviceMode#PROXY} (the default), then the other attributes control the behavior
* of the proxying. Please note that proxy mode allows for interception of calls through
* the proxy only; local calls within the same class cannot get intercepted that way.
*
* <p>If the {@linkplain #mode} is set to {@link AdviceMode#ASPECTJ}, then the
* {@link #proxyTargetClass()} attribute is obsolete. Note also that in this case the
* {@code spring-aspects} module JAR must be present on the classpath.
* <p>Note that if the {@linkplain #mode} is set to {@link AdviceMode#ASPECTJ}, then the
* value of the {@link #proxyTargetClass} attribute will be ignored. Note also that in
* this case the {@code spring-aspects} module JAR must be present on the classpath, with
* compile-time weaving or load-time weaving applying the aspect to the affected classes.
* There is no proxy involved in such a scenario; local calls will be intercepted as well.
*
* @author Chris Beams
* @author Juergen Hoeller
* @since 3.1
* @see CachingConfigurer
* @see CachingConfigurationSelector
...
...
@@ -183,16 +187,21 @@ public @interface EnableCaching {
boolean
proxyTargetClass
()
default
false
;
/**
* Indicate how caching advice should be applied. The default is
* {@link AdviceMode#PROXY}.
* @see AdviceMode
* Indicate how caching advice should be applied.
* <p><b>The default is {@link AdviceMode#PROXY}.</b>
* Please note that proxy mode allows for interception of calls through the proxy
* only. Local calls within the same class cannot get intercepted that way;
* a caching annotation on such a method within a local call will be ignored
* since Spring's interceptor does not even kick in for such a runtime scenario.
* For a more advanced mode of interception, consider switching this to
* {@link AdviceMode#ASPECTJ}.
*/
AdviceMode
mode
()
default
AdviceMode
.
PROXY
;
/**
* Indicate the ordering of the execution of the caching advisor
* when multiple advices are applied at a specific joinpoint.
* The default is {@link Ordered#LOWEST_PRECEDENCE}.
*
<p>
The default is {@link Ordered#LOWEST_PRECEDENCE}.
*/
int
order
()
default
Ordered
.
LOWEST_PRECEDENCE
;
...
...
spring-context/src/main/java/org/springframework/scheduling/annotation/EnableAsync.java
浏览文件 @
c7100f77
/*
* Copyright 2002-201
6
the original author or authors.
* Copyright 2002-201
7
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.
...
...
@@ -58,14 +58,6 @@ import org.springframework.core.Ordered;
* }
* }</pre>
*
* <p>The {@link #mode} attribute controls how advice is applied; if the mode is
* {@link AdviceMode#PROXY} (the default), then the other attributes control the behavior
* of the proxying.
*
* <p>Note that if the {@linkplain #mode} is set to {@link AdviceMode#ASPECTJ}, then the
* value of the {@link #proxyTargetClass} attribute will be ignored. Note also that in
* this case the {@code spring-aspects} module JAR must be present on the classpath.
*
* <p>By default, Spring will be searching for an associated thread pool definition:
* either a unique {@link org.springframework.core.task.TaskExecutor} bean in the context,
* or an {@link java.util.concurrent.Executor} bean named "taskExecutor" otherwise. If
...
...
@@ -140,6 +132,17 @@ import org.springframework.core.Ordered;
* demonstrates how the JavaConfig-based approach allows for maximum configurability
* through direct access to actual componentry.
*
* <p>The {@link #mode} attribute controls how advice is applied: If the mode is
* {@link AdviceMode#PROXY} (the default), then the other attributes control the behavior
* of the proxying. Please note that proxy mode allows for interception of calls through
* the proxy only; local calls within the same class cannot get intercepted that way.
*
* <p>Note that if the {@linkplain #mode} is set to {@link AdviceMode#ASPECTJ}, then the
* value of the {@link #proxyTargetClass} attribute will be ignored. Note also that in
* this case the {@code spring-aspects} module JAR must be present on the classpath, with
* compile-time weaving or load-time weaving applying the aspect to the affected classes.
* There is no proxy involved in such a scenario; local calls will be intercepted as well.
*
* @author Chris Beams
* @author Juergen Hoeller
* @author Stephane Nicoll
...
...
@@ -182,8 +185,13 @@ public @interface EnableAsync {
/**
* Indicate how async advice should be applied.
* <p>The default is {@link AdviceMode#PROXY}.
* @see AdviceMode
* <p><b>The default is {@link AdviceMode#PROXY}.</b>
* Please note that proxy mode allows for interception of calls through the proxy
* only. Local calls within the same class cannot get intercepted that way; an
* {@link Async} annotation on such a method within a local call will be ignored
* since Spring's interceptor does not even kick in for such a runtime scenario.
* For a more advanced mode of interception, consider switching this to
* {@link AdviceMode#ASPECTJ}.
*/
AdviceMode
mode
()
default
AdviceMode
.
PROXY
;
...
...
spring-tx/src/main/java/org/springframework/transaction/annotation/EnableTransactionManagement.java
浏览文件 @
c7100f77
/*
* Copyright 2002-201
6
the original author or authors.
* Copyright 2002-201
7
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.
...
...
@@ -131,15 +131,19 @@ import org.springframework.core.Ordered;
* {@code @Transactional} methods. See {@link TransactionManagementConfigurer} Javadoc
* for further details.
*
* <p>The {@link #mode
()} attribute controls how advice is applied; i
f the mode is
* <p>The {@link #mode
} attribute controls how advice is applied: I
f the mode is
* {@link AdviceMode#PROXY} (the default), then the other attributes control the behavior
* of the proxying.
* of the proxying. Please note that proxy mode allows for interception of calls through
* the proxy only; local calls within the same class cannot get intercepted that way.
*
* <p>If the {@linkplain #mode} is set to {@link AdviceMode#ASPECTJ}, then the
* {@link #proxyTargetClass()} attribute is obsolete. Note also that in this case the
* {@code spring-aspects} module JAR must be present on the classpath.
* <p>Note that if the {@linkplain #mode} is set to {@link AdviceMode#ASPECTJ}, then the
* value of the {@link #proxyTargetClass} attribute will be ignored. Note also that in
* this case the {@code spring-aspects} module JAR must be present on the classpath, with
* compile-time weaving or load-time weaving applying the aspect to the affected classes.
* There is no proxy involved in such a scenario; local calls will be intercepted as well.
*
* @author Chris Beams
* @author Juergen Hoeller
* @since 3.1
* @see TransactionManagementConfigurer
* @see TransactionManagementConfigurationSelector
...
...
@@ -167,16 +171,21 @@ public @interface EnableTransactionManagement {
boolean
proxyTargetClass
()
default
false
;
/**
* Indicate how transactional advice should be applied. The default is
* {@link AdviceMode#PROXY}.
* @see AdviceMode
* Indicate how transactional advice should be applied.
* <p><b>The default is {@link AdviceMode#PROXY}.</b>
* Please note that proxy mode allows for interception of calls through the proxy
* only. Local calls within the same class cannot get intercepted that way; an
* {@link Transactional} annotation on such a method within a local call will be
* ignored since Spring's interceptor does not even kick in for such a runtime
* scenario. For a more advanced mode of interception, consider switching this to
* {@link AdviceMode#ASPECTJ}.
*/
AdviceMode
mode
()
default
AdviceMode
.
PROXY
;
/**
* Indicate the ordering of the execution of the transaction advisor
* when multiple advices are applied at a specific joinpoint.
* The default is {@link Ordered#LOWEST_PRECEDENCE}.
*
<p>
The default is {@link Ordered#LOWEST_PRECEDENCE}.
*/
int
order
()
default
Ordered
.
LOWEST_PRECEDENCE
;
...
...
src/docs/asciidoc/data-access.adoc
浏览文件 @
c7100f77
...
...
@@ -1225,6 +1225,14 @@ any kind of method.
No specified ordering means that the AOP subsystem determines the order of the advice.
|===
[NOTE]
====
The default advice mode for processing `@Transactional` annotations is "proxy" which
allows for interception of calls through the proxy only; local calls within the same
class cannot get intercepted that way. For a more advanced mode of interception,
consider switching to "aspectj" mode in combination with compile/load-time weaving.
====
[NOTE]
====
The `proxy-target-class` attribute controls what type of transactional proxies are
...
...
src/docs/asciidoc/integration.adoc
浏览文件 @
c7100f77
...
...
@@ -6250,6 +6250,14 @@ Notice with the above XML that an executor reference is provided for handling th
tasks that correspond to methods with the `@Async` annotation, and the scheduler
reference is provided for managing those methods annotated with `@Scheduled`.
[NOTE]
====
The default advice mode for processing `@Async` annotations is "proxy" which allows
for interception of calls through the proxy only; local calls within the same class
cannot get intercepted that way. For a more advanced mode of interception, consider
switching to "aspectj" mode in combination with compile-time or load-time weaving.
====
[[scheduling-annotation-support-scheduled]]
==== The @Scheduled annotation
...
...
@@ -8313,8 +8321,16 @@ application through AOP. The configuration is intentionally similar with that of
[NOTE]
====
Advanced customizations using Java config require to implement `CachingConfigurer`, refer
to {api-spring-framework}/cache/annotation/CachingConfigurer.html[the
The default advice mode for processing caching annotations is "proxy" which allows
for interception of calls through the proxy only; local calls within the same class
cannot get intercepted that way. For a more advanced mode of interception, consider
switching to "aspectj" mode in combination with compile-time or load-time weaving.
====
[NOTE]
====
Advanced customizations using Java config require to implement `CachingConfigurer`:
Please refer to {api-spring-framework}/cache/annotation/CachingConfigurer.html[the
javadoc for more details].
====
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录