@ -484,7 +484,7 @@ pointcut expressions by name. The following example shows three pointcut express
@@ -484,7 +484,7 @@ pointcut expressions by name. The following example shows three pointcut express
@ -542,26 +542,26 @@ this purpose. Such an aspect typically resembles the following example:
@@ -542,26 +542,26 @@ this purpose. Such an aspect typically resembles the following example:
/**
* A join point is in the web layer if the method is defined
* in a type in the com.xyz.someapp.web package or any sub-package
* in a type in the com.xyz.myapp.web package or any sub-package
* under that.
*/
@Pointcut("within(com.xyz.someapp.web..*)")
@Pointcut("within(com.xyz.myapp.web..*)")
public void inWebLayer() {}
/**
* A join point is in the service layer if the method is defined
* in a type in the com.xyz.someapp.service package or any sub-package
* in a type in the com.xyz.myapp.service package or any sub-package
* under that.
*/
@Pointcut("within(com.xyz.someapp.service..*)")
@Pointcut("within(com.xyz.myapp.service..*)")
public void inServiceLayer() {}
/**
* A join point is in the data access layer if the method is defined
* in a type in the com.xyz.someapp.dao package or any sub-package
* in a type in the com.xyz.myapp.dao package or any sub-package
* under that.
*/
@Pointcut("within(com.xyz.someapp.dao..*)")
@Pointcut("within(com.xyz.myapp.dao..*)")
public void inDataAccessLayer() {}
/**
@ -570,15 +570,15 @@ this purpose. Such an aspect typically resembles the following example:
@@ -570,15 +570,15 @@ this purpose. Such an aspect typically resembles the following example:
* "service" package, and that implementation types are in sub-packages.
*
* If you group service interfaces by functional area (for example,
* in packages com.xyz.someapp.abc.service and com.xyz.someapp.def.service) then
* the pointcut expression "execution(* com.xyz.someapp..service.*.*(..))"
* in packages com.xyz.myapp.abc.service and com.xyz.myapp.def.service) then
* the pointcut expression "execution(* com.xyz.myapp..service.*.*(..))"
* could be used instead.
*
* Alternatively, you can write the expression using the 'bean'
* PCD, like so "bean(*Service)". (This assumes that you have
* named your Spring service beans in a consistent fashion.)
@ -586,7 +586,7 @@ this purpose. Such an aspect typically resembles the following example:
@@ -586,7 +586,7 @@ this purpose. Such an aspect typically resembles the following example:
* dao interface. This definition assumes that interfaces are placed in the
* "dao" package, and that implementation types are in sub-packages.
@ -594,7 +594,7 @@ this purpose. Such an aspect typically resembles the following example:
@@ -594,7 +594,7 @@ this purpose. Such an aspect typically resembles the following example:
@ -606,28 +606,28 @@ this purpose. Such an aspect typically resembles the following example:
@@ -606,28 +606,28 @@ this purpose. Such an aspect typically resembles the following example:
/**
* A join point is in the web layer if the method is defined
* in a type in the com.xyz.someapp.web package or any sub-package
* in a type in the com.xyz.myapp.web package or any sub-package
* under that.
*/
@Pointcut("within(com.xyz.someapp.web..*)")
@Pointcut("within(com.xyz.myapp.web..*)")
fun inWebLayer() {
}
/**
* A join point is in the service layer if the method is defined
* in a type in the com.xyz.someapp.service package or any sub-package
* in a type in the com.xyz.myapp.service package or any sub-package
* under that.
*/
@Pointcut("within(com.xyz.someapp.service..*)")
@Pointcut("within(com.xyz.myapp.service..*)")
fun inServiceLayer() {
}
/**
* A join point is in the data access layer if the method is defined
* in a type in the com.xyz.someapp.dao package or any sub-package
* in a type in the com.xyz.myapp.dao package or any sub-package
* under that.
*/
@Pointcut("within(com.xyz.someapp.dao..*)")
@Pointcut("within(com.xyz.myapp.dao..*)")
fun inDataAccessLayer() {
}
@ -637,15 +637,15 @@ this purpose. Such an aspect typically resembles the following example:
@@ -637,15 +637,15 @@ this purpose. Such an aspect typically resembles the following example:
* "service" package, and that implementation types are in sub-packages.
*
* If you group service interfaces by functional area (for example,
* in packages com.xyz.someapp.abc.service and com.xyz.someapp.def.service) then
* the pointcut expression "execution(* com.xyz.someapp..service.*.*(..))"
* in packages com.xyz.myapp.abc.service and com.xyz.myapp.def.service) then
* the pointcut expression "execution(* com.xyz.myapp..service.*.*(..))"
* could be used instead.
*
* Alternatively, you can write the expression using the 'bean'
* PCD, like so "bean(*Service)". (This assumes that you have
* named your Spring service beans in a consistent fashion.)
@ -654,7 +654,7 @@ this purpose. Such an aspect typically resembles the following example:
@@ -654,7 +654,7 @@ this purpose. Such an aspect typically resembles the following example:
* dao interface. This definition assumes that interfaces are placed in the
* "dao" package, and that implementation types are in sub-packages.
@ -1781,15 +1785,15 @@ annotation. Consider the following example:
@@ -1781,15 +1785,15 @@ annotation. Consider the following example:
}
----
In the preceding example, the effect of the `'perthis'` clause is that one aspect instance is created for
each unique service object that executes a business service (each unique object bound to
'this' at join points matched by the pointcut expression). The aspect instance is
created the first time that a method is invoked on the service object. The aspect goes
out of scope when the service object goes out of scope. Before the aspect instance is
created, none of the advice within it executes. As soon as the aspect instance has been
created, the advice declared within it executes at matched join points, but only
when the service object is the one with which this aspect is associated. See the AspectJ
Programming Guide for more information on `per` clauses.
In the preceding example, the effect of the `'perthis'` clause is that one aspect
instance is created for each unique service object that executes a business service (each
unique object bound to 'this' at join points matched by the pointcut expression). The
aspect instance is created the first time that a method is invoked on the service object.
The aspect goes out of scope when the service object goes out of scope. Before the aspect
instance is created, none of the advice within it executes. As soon as the aspect
instance has been created, the advice declared within it executes at matched join points,
but only when the service object is the one with which this aspect is associated. See the
AspectJ Programming Guide for more information on `per` clauses.
The `pertarget` instantiation model works in exactly the same way as `perthis`, but it
creates one aspect instance for each unique target object at matched join points.
@ -1949,7 +1953,8 @@ expression so that only `@Idempotent` operations match, as follows:
@@ -1949,7 +1953,8 @@ expression so that only `@Idempotent` operations match, as follows: