In this section:
- Spring AOP/@AspectJ
- AspectJ Support
An AspectJ facet which you can add to your Java modules lets you fine-tune the use of the AspectJ compiler at a module level.
Overview of AspectJ support
AspectJ support in IntelliJ IDEA Ultimate includes:
- Ability to create aspects in two forms: as
.javafiles containing classes annotated with
- Coding assistance (including code completion) when writing aspect code. For annotation-style aspects, the coding assistance is provided in full; for code-style aspects, the assistance is limited to inter-type declarations.
- Ability to perform basic aspect refactorings such as Rename and Move, and also the Push ITDs In refactoring for inter-type declarations.
- Integration with the AcpectJ compiler
ajcwhich you can run right from the IDE. (This compiler is part of the AspectJ distribution which you can download from the AspectJ website.)
- Ability to configure
ajcat the project level with an option of fine-tuning its use at the level of individual modules.
Overview of using AspectJ support
The tasks that are specific to AspectJ are outlined below.
- Make sure that:
- You are using the Ultimate Edition of IntelliJ IDEA. AspectJ is not supported in the Community Edition.
- The Spring AOP/@AspectJ and the AspectJ Support plugins are enabled. See Enabling AspectJ Support Plugins.
- Download and install AspectJ.
- Create a library containing
aspectjrt.jarand add this library to dependencies of the modules in which you are going to develop your aspects. Once you have installed AspectJ, you can find
<AspectJ installation directory>\lib. See Creating a Library for aspectjrt.jar.
- Create aspect files and develop the code. Note that code- and annotation-style aspects are supported.
- If necessary, refactor the aspect code.
- To use the AspectJ compiler, configure the compiler settings. The compiler (
ajc) is in
aspectjtools.jarwhich is located in
<AspectJ installation directory>\lib.
- To fine-tune the use of
ajcat the level of individual modules, add AspectJ facets to corresponding modules and adjust the facet settings accordingly.