Overview of AspectJ support
AspectJ support in IntelliJ IDEA includes:
- Ability to create aspects in two forms: as .aj files and .java files containing classes annotated with @Aspect.
- 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 ajc which you can run from within the IDE. (This compiler is part of AspectJ Development Kit (AJDK) which you can download from the AspectJ website.)
- Ability to flexibly configure ajc at the project level with an option of redefining the main settings (aspectpath) at the module level.
Outlined below are the tasks that are specific to AspectJ. For general instructions, see IntelliJ IDEAUsage Guidelines.
- Make sure that the Spring-AOP and @AspectJ Support and the AspectJ Support plugins are enabled (see Enabling AspectJ Support Plugins).
- Download and install the AspectJ Development Kit (AJDK).
- Create a library containing aspectjrt.jar and add this library to dependencies of the modules in which you are going to develop your aspects. After the installation of AJDK, aspectjrt.jar can be found in <AJDK installation directory>\lib. See Creating a Library for aspectjrt.jar.
- Create the aspect files and develop the code. Note that code- and annotation-style aspects are supported.
- If necessary, refactor the aspect code.
- If you are going to use the AspectJ compiler, configure the compiler settings. The compiler (ajc) is in aspectjtools.jar which is located in <AJDK installation directory>\lib.
- If you are going to use module-specific aspectpath, add AspectJ facets to the corresponding modules and adjust the facet settings accordingly.