IntelliJ IDEA 14.0.0 Web Help

AspectJ

IntelliJ IDEA's support for AspectJ is based on the following plugins that are bundled with the IDE:

  • 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.

On this page:

In this section:

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 the AspectJ distribution which you can download from the AspectJ website.)
  • Ability to flexibly configure ajc at the project level with an option of fine-tuning its use at the module level.

Overview of using AspectJ support

  1. Make sure that the Spring AOP/@AspectJ and the AspectJ Support plugins are enabled (see Enabling AspectJ Support Plugins).
  2. Download and install AspectJ.
  3. 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 AspectJ, aspectjrt.jar can be found in <AspectJ installation directory>\lib. See Creating a Library for aspectjrt.jar.
  4. Create aspect files and develop the code. Note that code- and annotation-style aspects are supported.
  5. If necessary, refactor the aspect code.
  6. To use the AspectJ compiler, configure the compiler settings. The compiler (ajc) is in aspectjtools.jar which is located in <AspectJ installation directory>\lib.
  7. To fine-tune the use of ajc at the level of individual modules, add AspectJ facets to corresponding modules and adjust the facet settings accordingly.

See Also

Concepts:

External Links:

Web Resources:

Last modified: 12 November 2014
comments powered by Disqus