Advantages of AOP

  1. It is non-invasive – not touching our code or business logic. plug and play like

    • Your service/domain classes get advised by the aspects (cross cutting concerns) without adding any Spring AOP related classes or interfaces into the service/domain classes.

    • Allows the developer to concentrate on the business code, instead the cross cutting concerns.

  2. Its implemented in pure Java

    • No need for a special compilation unit, or a special class loader

  3. It uses Spring’s IOC for dependency injection

    • Aspects can be configured as normal spring beans.

  4. As any other AOP framework, it weaves cross cutting concerns into the classes, without making a call to the cross cutting concerns from those classes.

  5. Centralize or modularize the cross cutting concerns (read meaning of cross cutting concerns above)

    • Easy to maintain and make changes to the aspects

    • Changes need to be made in one place.

    • In one of your classes you don’t want to have logging, it can easily be achieved by modifying the point cut in the respective aspect (logging aspect). So you need to make changes in only one place.

  6. Provision to create aspects using schema based (XML configuration) or @AspectJ annotation based style.

  7. Easy to configure