@@ -1637,16 +1637,16 @@ In many cases, you do this binding anyway (as in the preceding example).
1637
1637
1638
1638
What happens when multiple pieces of advice all want to run at the same join point?
1639
1639
Spring AOP follows the same precedence rules as AspectJ to determine the order of advice
1640
- execution. The highest precedence advice runs first "` on the way in` " (so, given two pieces
1641
- of before advice, the one with highest precedence runs first). "` On the way out` " from a
1640
+ execution. The highest precedence advice runs first "on the way in" (so, given two pieces
1641
+ of before advice, the one with highest precedence runs first). "On the way out" from a
1642
1642
join point, the highest precedence advice runs last (so, given two pieces of after
1643
1643
advice, the one with the highest precedence will run second).
1644
1644
1645
1645
When two pieces of advice defined in different aspects both need to run at the same
1646
1646
join point, unless you specify otherwise, the order of execution is undefined. You can
1647
1647
control the order of execution by specifying precedence. This is done in the normal
1648
1648
Spring way by either implementing the `org.springframework.core.Ordered` interface in
1649
- the aspect class or annotating it with the `Order` annotation. Given two aspects, the
1649
+ the aspect class or annotating it with the `@ Order` annotation. Given two aspects, the
1650
1650
aspect returning the lower value from `Ordered.getValue()` (or the annotation value) has
1651
1651
the higher precedence.
1652
1652
@@ -1950,9 +1950,9 @@ expression so that only `@Idempotent` operations match, as follows:
1950
1950
== Schema-based AOP Support
1951
1951
1952
1952
If you prefer an XML-based format, Spring also offers support for defining aspects
1953
- using the new `aop` namespace tags. The exact same pointcut expressions and advice kinds
1953
+ using the `aop` namespace tags. The exact same pointcut expressions and advice kinds
1954
1954
as when using the @AspectJ style are supported. Hence, in this section we focus on
1955
- the new syntax and refer the reader to the discussion in the previous section
1955
+ that syntax and refer the reader to the discussion in the previous section
1956
1956
(<<aop-ataspectj>>) for an understanding of writing pointcut expressions and the binding
1957
1957
of advice parameters.
1958
1958
@@ -1982,7 +1982,7 @@ When you use the schema support, an aspect is a regular Java object defined as a
1982
1982
your Spring application context. The state and behavior are captured in the fields and
1983
1983
methods of the object, and the pointcut and advice information are captured in the XML.
1984
1984
1985
- You can declare an aspect by using the <aop:aspect> element, and reference the backing bean
1985
+ You can declare an aspect by using the ` <aop:aspect>` element, and reference the backing bean
1986
1986
by using the `ref` attribute, as the following example shows:
1987
1987
1988
1988
[source,xml,indent=0,subs="verbatim,quotes"]
@@ -2069,7 +2069,7 @@ collects the `this` object as the join point context and passes it to the advice
2069
2069
<aop:aspect id="myAspect" ref="aBean">
2070
2070
2071
2071
<aop:pointcut id="businessService"
2072
- expression="execution(* com.xyz.myapp.service.*.*(..)) && this(service)"/>
2072
+ expression="execution(* com.xyz.myapp.service.*.*(..)) && this(service)"/>
2073
2073
2074
2074
<aop:before pointcut-ref="businessService" method="monitor"/>
2075
2075
@@ -2098,9 +2098,10 @@ parameters of the matching names, as follows:
2098
2098
}
2099
2099
----
2100
2100
2101
- When combining pointcut sub-expressions, `&&` is awkward within an XML document, so
2102
- you can use the `and`, `or`, and `not` keywords in place of `&&`, `||`, and `!`,
2103
- respectively. For example, the previous pointcut can be better written as follows:
2101
+ When combining pointcut sub-expressions, `+&&+` is awkward within an XML
2102
+ document, so you can use the `and`, `or`, and `not` keywords in place of `+&&+`,
2103
+ `||`, and `!`, respectively. For example, the previous pointcut can be better written as
2104
+ follows:
2104
2105
2105
2106
[source,xml,indent=0,subs="verbatim"]
2106
2107
----
@@ -2136,7 +2137,7 @@ exactly the same semantics.
2136
2137
==== Before Advice
2137
2138
2138
2139
Before advice runs before a matched method execution. It is declared inside an
2139
- `<aop:aspect>` by using the <aop:before> element, as the following example shows:
2140
+ `<aop:aspect>` by using the ` <aop:before>` element, as the following example shows:
2140
2141
2141
2142
[source,xml,indent=0,subs="verbatim,quotes"]
2142
2143
----
@@ -2198,8 +2199,8 @@ shows how to declare it:
2198
2199
</aop:aspect>
2199
2200
----
2200
2201
2201
- As in the @AspectJ style, you can get the return value within the
2202
- advice body. To do so, use the returning attribute to specify the name of the parameter to which
2202
+ As in the @AspectJ style, you can get the return value within the advice body.
2203
+ To do so, use the ` returning` attribute to specify the name of the parameter to which
2203
2204
the return value should be passed, as the following example shows:
2204
2205
2205
2206
[source,xml,indent=0,subs="verbatim,quotes"]
@@ -2236,7 +2237,7 @@ example, you can declare the method signature as follows:
2236
2237
==== After Throwing Advice
2237
2238
2238
2239
After throwing advice executes when a matched method execution exits by throwing an
2239
- exception. It is declared inside an `<aop:aspect>` by using the after-throwing element,
2240
+ exception. It is declared inside an `<aop:aspect>` by using the ` after-throwing` element,
2240
2241
as the following example shows:
2241
2242
2242
2243
[source,xml,indent=0,subs="verbatim,quotes"]
@@ -2252,8 +2253,8 @@ as the following example shows:
2252
2253
</aop:aspect>
2253
2254
----
2254
2255
2255
- As in the @AspectJ style, you can get the thrown exception within
2256
- the advice body. To do so, use the throwing attribute to specify the name of the parameter to
2256
+ As in the @AspectJ style, you can get the thrown exception within the advice body.
2257
+ To do so, use the ` throwing` attribute to specify the name of the parameter to
2257
2258
which the exception should be passed as the following example shows:
2258
2259
2259
2260
[source,xml,indent=0,subs="verbatim,quotes"]
@@ -2309,7 +2310,7 @@ by using the `after` element, as the following example shows:
2309
2310
[[aop-schema-advice-around]]
2310
2311
==== Around Advice
2311
2312
2312
- The last kind of advice is around advice. Around advice runs "` around` " a matched method
2313
+ The last kind of advice is around advice. Around advice runs "around" a matched method
2313
2314
execution. It has the opportunity to do work both before and after the method executes
2314
2315
and to determine when, how, and even if the method actually gets to execute at all.
2315
2316
Around advice is often used to share state before and after a method
@@ -2548,10 +2549,11 @@ ms % Task name
2548
2549
[[aop-ordering]]
2549
2550
==== Advice Ordering
2550
2551
2551
- When multiple advice needs to execute at the same join point (executing method) the
2552
- ordering rules are as described in <<aop-ataspectj-advice-ordering>>. The precedence
2553
- between aspects is determined by either adding the `Order` annotation to the bean
2554
- that backs the aspect or by having the bean implement the `Ordered` interface.
2552
+ When multiple pieces of advice need to execute at the same join point (executing method)
2553
+ the ordering rules are as described in <<aop-ataspectj-advice-ordering>>. The precedence
2554
+ between aspects is determined via the `order` attribute in the `<aop:aspect>` element or
2555
+ by either adding the `@Order` annotation to the bean that backs the aspect or by having
2556
+ the bean implement the `Ordered` interface.
2555
2557
2556
2558
2557
2559
0 commit comments