Skip to content

Commit 1631be5

Browse files
committed
Provide guidelines in AspectJ documentation to avoid dumps
Closes gh-27650
1 parent 9ccc72a commit 1631be5

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

framework-docs/modules/ROOT/pages/core/aop/using-aspectj.adoc

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,11 @@ standard AspectJ. The following example shows the `aop.xml` file:
533533
</aspectj>
534534
----
535535

536+
NOTE: It is recommended to only weave specific classes (typically those in the
537+
application packages, as shown in the `aop.xml` example above) in order
538+
to avoid side effects such as AspectJ dump files and warnings.
539+
This is also a best practice from an efficiency perspective.
540+
536541
Now we can move on to the Spring-specific portion of the configuration. We need
537542
to configure a `LoadTimeWeaver` (explained later). This load-time weaver is the
538543
essential component responsible for weaving the aspect configuration in one or
@@ -714,10 +719,29 @@ Furthermore, the compiled aspect classes need to be available on the classpath.
714719

715720

716721
[[aop-aj-ltw-aop_dot_xml]]
717-
=== 'META-INF/aop.xml'
722+
=== `META-INF/aop.xml`
718723

719724
The AspectJ LTW infrastructure is configured by using one or more `META-INF/aop.xml`
720725
files that are on the Java classpath (either directly or, more typically, in jar files).
726+
For example:
727+
728+
[source,xml,indent=0,subs="verbatim"]
729+
----
730+
<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "https://www.eclipse.org/aspectj/dtd/aspectj.dtd">
731+
<aspectj>
732+
733+
<weaver>
734+
<!-- only weave classes in our application-specific packages -->
735+
<include within="com.xyz.*"/>
736+
</weaver>
737+
738+
</aspectj>
739+
----
740+
741+
NOTE: It is recommended to only weave specific classes (typically those in the
742+
application packages, as shown in the `aop.xml` example above) in order
743+
to avoid side effects such as AspectJ dump files and warnings.
744+
This is also a best practice from an efficiency perspective.
721745

722746
The structure and contents of this file is detailed in the LTW part of the
723747
{aspectj-docs-devguide}/ltw-configuration.html[AspectJ reference

0 commit comments

Comments
 (0)