@@ -524,10 +524,10 @@ matching.
524
524
[[aop-common-pointcuts]]
525
525
==== Sharing Common Pointcut Definitions
526
526
527
- When working with enterprise applications, developers often want to refer to modules of the
528
- application and particular sets of operations from within several aspects. We recommend
529
- defining a `SystemArchitecture ` aspect that captures common pointcut expressions for
530
- this purpose. Such an aspect typically resembles the following example:
527
+ When working with enterprise applications, developers often want to refer to modules of
528
+ the application and particular sets of operations from within several aspects. We
529
+ recommend defining a `CommonPointcuts ` aspect that captures common pointcut expressions
530
+ for this purpose. Such an aspect typically resembles the following example:
531
531
532
532
[source,java,indent=0,subs="verbatim",role="primary"]
533
533
.Java
@@ -538,7 +538,7 @@ this purpose. Such an aspect typically resembles the following example:
538
538
import org.aspectj.lang.annotation.Pointcut;
539
539
540
540
@Aspect
541
- public class SystemArchitecture {
541
+ public class CommonPointcuts {
542
542
543
543
/**
544
544
* A join point is in the web layer if the method is defined
@@ -602,7 +602,7 @@ this purpose. Such an aspect typically resembles the following example:
602
602
import org.springframework.aop.Pointcut
603
603
604
604
@Aspect
605
- class SystemArchitecture {
605
+ class CommonPointcuts {
606
606
607
607
/**
608
608
* A join point is in the web layer if the method is defined
@@ -669,7 +669,7 @@ write the following:
669
669
----
670
670
<aop:config>
671
671
<aop:advisor
672
- pointcut="com.xyz.myapp.SystemArchitecture .businessService()"
672
+ pointcut="com.xyz.myapp.CommonPointcuts .businessService()"
673
673
advice-ref="tx-advice"/>
674
674
</aop:config>
675
675
@@ -923,7 +923,7 @@ You can declare before advice in an aspect by using the `@Before` annotation:
923
923
@Aspect
924
924
public class BeforeExample {
925
925
926
- @Before("com.xyz.myapp.SystemArchitecture .dataAccessOperation()")
926
+ @Before("com.xyz.myapp.CommonPointcuts .dataAccessOperation()")
927
927
public void doAccessCheck() {
928
928
// ...
929
929
}
@@ -939,7 +939,7 @@ You can declare before advice in an aspect by using the `@Before` annotation:
939
939
@Aspect
940
940
class BeforeExample {
941
941
942
- @Before("com.xyz.myapp.SystemArchitecture .dataAccessOperation()")
942
+ @Before("com.xyz.myapp.CommonPointcuts .dataAccessOperation()")
943
943
fun doAccessCheck() {
944
944
// ...
945
945
}
@@ -999,7 +999,7 @@ declare it by using the `@AfterReturning` annotation:
999
999
@Aspect
1000
1000
public class AfterReturningExample {
1001
1001
1002
- @AfterReturning("com.xyz.myapp.SystemArchitecture .dataAccessOperation()")
1002
+ @AfterReturning("com.xyz.myapp.CommonPointcuts .dataAccessOperation()")
1003
1003
public void doAccessCheck() {
1004
1004
// ...
1005
1005
}
@@ -1015,7 +1015,7 @@ declare it by using the `@AfterReturning` annotation:
1015
1015
@Aspect
1016
1016
class AfterReturningExample {
1017
1017
1018
- @AfterReturning("com.xyz.myapp.SystemArchitecture .dataAccessOperation()")
1018
+ @AfterReturning("com.xyz.myapp.CommonPointcuts .dataAccessOperation()")
1019
1019
fun doAccessCheck() {
1020
1020
// ...
1021
1021
}
@@ -1040,7 +1040,7 @@ the following example shows:
1040
1040
public class AfterReturningExample {
1041
1041
1042
1042
@AfterReturning(
1043
- pointcut="com.xyz.myapp.SystemArchitecture .dataAccessOperation()",
1043
+ pointcut="com.xyz.myapp.CommonPointcuts .dataAccessOperation()",
1044
1044
returning="retVal")
1045
1045
public void doAccessCheck(Object retVal) {
1046
1046
// ...
@@ -1058,7 +1058,7 @@ the following example shows:
1058
1058
class AfterReturningExample {
1059
1059
1060
1060
@AfterReturning(
1061
- pointcut = "com.xyz.myapp.SystemArchitecture .dataAccessOperation()",
1061
+ pointcut = "com.xyz.myapp.CommonPointcuts .dataAccessOperation()",
1062
1062
returning = "retVal")
1063
1063
fun doAccessCheck(retVal: Any) {
1064
1064
// ...
@@ -1093,7 +1093,7 @@ example shows:
1093
1093
@Aspect
1094
1094
public class AfterThrowingExample {
1095
1095
1096
- @AfterThrowing("com.xyz.myapp.SystemArchitecture .dataAccessOperation()")
1096
+ @AfterThrowing("com.xyz.myapp.CommonPointcuts .dataAccessOperation()")
1097
1097
public void doRecoveryActions() {
1098
1098
// ...
1099
1099
}
@@ -1109,7 +1109,7 @@ example shows:
1109
1109
@Aspect
1110
1110
class AfterThrowingExample {
1111
1111
1112
- @AfterThrowing("com.xyz.myapp.SystemArchitecture .dataAccessOperation()")
1112
+ @AfterThrowing("com.xyz.myapp.CommonPointcuts .dataAccessOperation()")
1113
1113
fun doRecoveryActions() {
1114
1114
// ...
1115
1115
}
@@ -1133,7 +1133,7 @@ following example shows how to do so:
1133
1133
public class AfterThrowingExample {
1134
1134
1135
1135
@AfterThrowing(
1136
- pointcut="com.xyz.myapp.SystemArchitecture .dataAccessOperation()",
1136
+ pointcut="com.xyz.myapp.CommonPointcuts .dataAccessOperation()",
1137
1137
throwing="ex")
1138
1138
public void doRecoveryActions(DataAccessException ex) {
1139
1139
// ...
@@ -1151,7 +1151,7 @@ following example shows how to do so:
1151
1151
class AfterThrowingExample {
1152
1152
1153
1153
@AfterThrowing(
1154
- pointcut = "com.xyz.myapp.SystemArchitecture .dataAccessOperation()",
1154
+ pointcut = "com.xyz.myapp.CommonPointcuts .dataAccessOperation()",
1155
1155
throwing = "ex")
1156
1156
fun doRecoveryActions(ex: DataAccessException) {
1157
1157
// ...
@@ -1184,7 +1184,7 @@ The following example shows how to use after finally advice:
1184
1184
@Aspect
1185
1185
public class AfterFinallyExample {
1186
1186
1187
- @After("com.xyz.myapp.SystemArchitecture .dataAccessOperation()")
1187
+ @After("com.xyz.myapp.CommonPointcuts .dataAccessOperation()")
1188
1188
public void doReleaseLock() {
1189
1189
// ...
1190
1190
}
@@ -1200,7 +1200,7 @@ The following example shows how to use after finally advice:
1200
1200
@Aspect
1201
1201
class AfterFinallyExample {
1202
1202
1203
- @After("com.xyz.myapp.SystemArchitecture .dataAccessOperation()")
1203
+ @After("com.xyz.myapp.CommonPointcuts .dataAccessOperation()")
1204
1204
fun doReleaseLock() {
1205
1205
// ...
1206
1206
}
@@ -1252,7 +1252,7 @@ The following example shows how to use around advice:
1252
1252
@Aspect
1253
1253
public class AroundExample {
1254
1254
1255
- @Around("com.xyz.myapp.SystemArchitecture .businessService()")
1255
+ @Around("com.xyz.myapp.CommonPointcuts .businessService()")
1256
1256
public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable {
1257
1257
// start stopwatch
1258
1258
Object retVal = pjp.proceed();
@@ -1272,7 +1272,7 @@ The following example shows how to use around advice:
1272
1272
@Aspect
1273
1273
class AroundExample {
1274
1274
1275
- @Around("com.xyz.myapp.SystemArchitecture .businessService()")
1275
+ @Around("com.xyz.myapp.CommonPointcuts .businessService()")
1276
1276
fun doBasicProfiling(pjp: ProceedingJoinPoint): Any {
1277
1277
// start stopwatch
1278
1278
val retVal = pjp.proceed()
@@ -1331,15 +1331,15 @@ You could write the following:
1331
1331
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
1332
1332
.Java
1333
1333
----
1334
- @Before("com.xyz.myapp.SystemArchitecture .dataAccessOperation() && args(account,..)")
1334
+ @Before("com.xyz.myapp.CommonPointcuts .dataAccessOperation() && args(account,..)")
1335
1335
public void validateAccount(Account account) {
1336
1336
// ...
1337
1337
}
1338
1338
----
1339
1339
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
1340
1340
.Kotlin
1341
1341
----
1342
- @Before("com.xyz.myapp.SystemArchitecture .dataAccessOperation() && args(account,..)")
1342
+ @Before("com.xyz.myapp.CommonPointcuts .dataAccessOperation() && args(account,..)")
1343
1343
fun validateAccount(account: Account) {
1344
1344
// ...
1345
1345
}
@@ -1358,7 +1358,7 @@ from the advice. This would look as follows:
1358
1358
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
1359
1359
.Java
1360
1360
----
1361
- @Pointcut("com.xyz.myapp.SystemArchitecture .dataAccessOperation() && args(account,..)")
1361
+ @Pointcut("com.xyz.myapp.CommonPointcuts .dataAccessOperation() && args(account,..)")
1362
1362
private void accountDataAccessOperation(Account account) {}
1363
1363
1364
1364
@Before("accountDataAccessOperation(account)")
@@ -1369,7 +1369,7 @@ from the advice. This would look as follows:
1369
1369
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
1370
1370
.Kotlin
1371
1371
----
1372
- @Pointcut("com.xyz.myapp.SystemArchitecture .dataAccessOperation() && args(account,..)")
1372
+ @Pointcut("com.xyz.myapp.CommonPointcuts .dataAccessOperation() && args(account,..)")
1373
1373
private fun accountDataAccessOperation(account: Account) {
1374
1374
}
1375
1375
@@ -1612,7 +1612,7 @@ The following example shows how to do so:
1612
1612
.Java
1613
1613
----
1614
1614
@Around("execution(List<Account> find*(..)) && " +
1615
- "com.xyz.myapp.SystemArchitecture .inDataAccessLayer() && " +
1615
+ "com.xyz.myapp.CommonPointcuts .inDataAccessLayer() && " +
1616
1616
"args(accountHolderNamePattern)")
1617
1617
public Object preProcessQueryPattern(ProceedingJoinPoint pjp,
1618
1618
String accountHolderNamePattern) throws Throwable {
@@ -1624,7 +1624,7 @@ The following example shows how to do so:
1624
1624
.Kotlin
1625
1625
----
1626
1626
@Around("execution(List<Account> find*(..)) && " +
1627
- "com.xyz.myapp.SystemArchitecture .inDataAccessLayer() && " +
1627
+ "com.xyz.myapp.CommonPointcuts .inDataAccessLayer() && " +
1628
1628
"args(accountHolderNamePattern)")
1629
1629
fun preProcessQueryPattern(pjp: ProceedingJoinPoint,
1630
1630
accountHolderNamePattern: String): Any {
@@ -1695,7 +1695,7 @@ the `UsageTracked` interface (to expose statistics via JMX for example):
1695
1695
@DeclareParents(value="com.xzy.myapp.service.*+", defaultImpl=DefaultUsageTracked.class)
1696
1696
public static UsageTracked mixin;
1697
1697
1698
- @Before("com.xyz.myapp.SystemArchitecture .businessService() && this(usageTracked)")
1698
+ @Before("com.xyz.myapp.CommonPointcuts .businessService() && this(usageTracked)")
1699
1699
public void recordUsage(UsageTracked usageTracked) {
1700
1700
usageTracked.incrementUseCount();
1701
1701
}
@@ -1713,7 +1713,7 @@ the `UsageTracked` interface (to expose statistics via JMX for example):
1713
1713
lateinit var mixin: UsageTracked
1714
1714
}
1715
1715
1716
- @Before("com.xyz.myapp.SystemArchitecture .businessService() && this(usageTracked)")
1716
+ @Before("com.xyz.myapp.CommonPointcuts .businessService() && this(usageTracked)")
1717
1717
fun recordUsage(usageTracked: UsageTracked) {
1718
1718
usageTracked.incrementUseCount()
1719
1719
}
@@ -1757,12 +1757,12 @@ annotation. Consider the following example:
1757
1757
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
1758
1758
.Java
1759
1759
----
1760
- @Aspect("perthis(com.xyz.myapp.SystemArchitecture .businessService())")
1760
+ @Aspect("perthis(com.xyz.myapp.CommonPointcuts .businessService())")
1761
1761
public class MyAspect {
1762
1762
1763
1763
private int someState;
1764
1764
1765
- @Before("com.xyz.myapp.SystemArchitecture .businessService()")
1765
+ @Before("com.xyz.myapp.CommonPointcuts .businessService()")
1766
1766
public void recordServiceUsage() {
1767
1767
// ...
1768
1768
}
@@ -1772,12 +1772,12 @@ annotation. Consider the following example:
1772
1772
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
1773
1773
.Kotlin
1774
1774
----
1775
- @Aspect("perthis(com.xyz.myapp.SystemArchitecture .businessService())")
1775
+ @Aspect("perthis(com.xyz.myapp.CommonPointcuts .businessService())")
1776
1776
class MyAspect {
1777
1777
1778
1778
private val someState: Int = 0
1779
1779
1780
- @Before("com.xyz.myapp.SystemArchitecture .businessService()")
1780
+ @Before("com.xyz.myapp.CommonPointcuts .businessService()")
1781
1781
fun recordServiceUsage() {
1782
1782
// ...
1783
1783
}
@@ -1841,7 +1841,7 @@ call `proceed` multiple times. The following listing shows the basic aspect impl
1841
1841
this.order = order;
1842
1842
}
1843
1843
1844
- @Around("com.xyz.myapp.SystemArchitecture .businessService()")
1844
+ @Around("com.xyz.myapp.CommonPointcuts .businessService()")
1845
1845
public Object doConcurrentOperation(ProceedingJoinPoint pjp) throws Throwable {
1846
1846
int numAttempts = 0;
1847
1847
PessimisticLockingFailureException lockFailureException;
@@ -1881,7 +1881,7 @@ call `proceed` multiple times. The following listing shows the basic aspect impl
1881
1881
this.order = order
1882
1882
}
1883
1883
1884
- @Around("com.xyz.myapp.SystemArchitecture .businessService()")
1884
+ @Around("com.xyz.myapp.CommonPointcuts .businessService()")
1885
1885
fun doConcurrentOperation(pjp: ProceedingJoinPoint): Any {
1886
1886
var numAttempts = 0
1887
1887
var lockFailureException: PessimisticLockingFailureException
@@ -1944,7 +1944,7 @@ expression so that only `@Idempotent` operations match, as follows:
1944
1944
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
1945
1945
.Java
1946
1946
----
1947
- @Around("com.xyz.myapp.SystemArchitecture .businessService() && " +
1947
+ @Around("com.xyz.myapp.CommonPointcuts .businessService() && " +
1948
1948
"@annotation(com.xyz.myapp.service.Idempotent)")
1949
1949
public Object doConcurrentOperation(ProceedingJoinPoint pjp) throws Throwable {
1950
1950
// ...
@@ -1953,7 +1953,7 @@ expression so that only `@Idempotent` operations match, as follows:
1953
1953
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
1954
1954
.Kotlin
1955
1955
----
1956
- @Around("com.xyz.myapp.SystemArchitecture .businessService() && " +
1956
+ @Around("com.xyz.myapp.CommonPointcuts .businessService() && " +
1957
1957
"@annotation(com.xyz.myapp.service.Idempotent)")
1958
1958
fun doConcurrentOperation(pjp: ProceedingJoinPoint): Any {
1959
1959
// ...
@@ -2048,12 +2048,12 @@ pointcut expression. Another way of defining the above pointcut would be as foll
2048
2048
<aop:config>
2049
2049
2050
2050
<aop:pointcut id="businessService"
2051
- expression="com.xyz.myapp.SystemArchitecture .businessService()"/>
2051
+ expression="com.xyz.myapp.CommonPointcuts .businessService()"/>
2052
2052
2053
2053
</aop:config>
2054
2054
----
2055
2055
2056
- Assume that you have a `SystemArchitecture ` aspect as described in <<aop-common-pointcuts>>.
2056
+ Assume that you have a `CommonPointcuts ` aspect as described in <<aop-common-pointcuts>>.
2057
2057
2058
2058
Then declaring a pointcut inside an aspect is very similar to declaring a top-level pointcut,
2059
2059
as the following example shows:
@@ -2617,7 +2617,7 @@ through JMX for example.)
2617
2617
default-impl="com.xyz.myapp.service.tracking.DefaultUsageTracked"/>
2618
2618
2619
2619
<aop:before
2620
- pointcut="com.xyz.myapp.SystemArchitecture .businessService()
2620
+ pointcut="com.xyz.myapp.CommonPointcuts .businessService()
2621
2621
and this(usageTracked)"
2622
2622
method="recordUsage"/>
2623
2623
@@ -3606,7 +3606,7 @@ fully qualified class names:
3606
3606
// the creation of a new bean (any object in the domain model)
3607
3607
protected pointcut beanCreation(Object beanInstance) :
3608
3608
initialization(new(..)) &&
3609
- SystemArchitecture .inDomainModel() &&
3609
+ CommonPointcuts .inDomainModel() &&
3610
3610
this(beanInstance);
3611
3611
}
3612
3612
----
0 commit comments