@AspectJ annotation-based Spring AOP

Spring allows another way to support AOP through the @AspectJ annotation. It's an alternative to XML-based configuration to define the aspect using regular Java classes with AOP-specific annotation. Spring introduced the @AspectJ style as a part of the AspectJ 5 release. Though with @AspectJ, Spring facilitates same annotation like AspectJ 5, the underlying framework is pure Spring AOP. Due to this arrangement, there is no dependency on AspectJ compiler or weaver.

To use @AspectJ annotation for Spring AOP, you need to enable its support in Spring through configuration and turn auto-proxy on. Autoproxying is a mechanism to create a proxy on the object of a Spring bean on which one or more aspects are woven. ...

Get Java 9 Dependency Injection now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.