Skip to content

Commit 040ea0a

Browse files
committed
Remove @aspect for classes containing only @pointcut declarations in ref docs
Closes gh-30790
1 parent 3c05679 commit 040ea0a

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

framework-docs/modules/ROOT/pages/core/aop/ataspectj/pointcuts.adoc

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ Java::
154154
----
155155
package com.xyz;
156156
157-
@Aspect
158157
public class Pointcuts {
159158
160159
@Pointcut("execution(public * *(..))")
@@ -179,7 +178,6 @@ Kotlin::
179178
----
180179
package com.xyz
181180
182-
@Aspect
183181
class Pointcuts {
184182
185183
@Pointcut("execution(public * *(..))")
@@ -211,9 +209,9 @@ pointcut matching.
211209

212210
When working with enterprise applications, developers often have the need to refer to
213211
modules of the application and particular sets of operations from within several aspects.
214-
We recommend defining a dedicated aspect that captures commonly used _named pointcut_
215-
expressions for this purpose. Such an aspect typically resembles the following
216-
`CommonPointcuts` example (though what you name the aspect is up to you):
212+
We recommend defining a dedicated class that captures commonly used _named pointcut_
213+
expressions for this purpose. Such a class typically resembles the following
214+
`CommonPointcuts` example (though what you name the class is up to you):
217215

218216
[tabs]
219217
======
@@ -223,10 +221,8 @@ Java::
223221
----
224222
package com.xyz;
225223
226-
import org.aspectj.lang.annotation.Aspect;
227224
import org.aspectj.lang.annotation.Pointcut;
228225
229-
@Aspect
230226
public class CommonPointcuts {
231227
232228
/**
@@ -287,10 +283,8 @@ Kotlin::
287283
----
288284
package com.xyz
289285
290-
import org.aspectj.lang.annotation.Aspect
291286
import org.aspectj.lang.annotation.Pointcut
292287
293-
@Aspect
294288
class CommonPointcuts {
295289
296290
/**
@@ -346,9 +340,9 @@ Kotlin::
346340
----
347341
======
348342

349-
You can refer to the pointcuts defined in such an aspect anywhere you need a pointcut
350-
expression by referencing the fully-qualified name of the `@Aspect` class combined with
351-
the `@Pointcut` method's name. For example, to make the service layer transactional, you
343+
You can refer to the pointcuts defined in such a class anywhere you need a pointcut
344+
expression by referencing the fully-qualified name of the class combined with the
345+
`@Pointcut` method's name. For example, to make the service layer transactional, you
352346
could write the following which references the
353347
`com.xyz.CommonPointcuts.businessService()` _named pointcut_:
354348

spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -637,17 +637,20 @@ public int getOrder() {
637637
}
638638

639639

640+
static class CommonPointcuts {
641+
642+
@Pointcut("execution(* getAge())")
643+
void getAge() {
644+
}
645+
}
646+
640647
@Aspect
641648
static class NamedPointcutAspectWithFQN {
642649

643650
@SuppressWarnings("unused")
644651
private ITestBean fieldThatShouldBeIgnoredBySpringAtAspectJProcessing = new TestBean();
645652

646-
@Pointcut("execution(* getAge())")
647-
void getAge() {
648-
}
649-
650-
@Around("org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactoryTests.NamedPointcutAspectWithFQN.getAge()")
653+
@Around("org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactoryTests.CommonPointcuts.getAge()()")
651654
int changeReturnValue(ProceedingJoinPoint pjp) {
652655
return -1;
653656
}

0 commit comments

Comments
 (0)