Spring framework comes with AOP support. In fact, as stated in Spring reference documentation,
“One of the key components of Spring is the AOP framework. While the Spring IoC container does not depend on AOP, meaning you do not need to use AOP if you don't want to, AOP complements Spring IoC to provide a very capable middleware solution. AOP is used in the Spring Framework to...
- ... provide declarative enterprise services, especially as a replacement for EJB declarative services. The most important such service is declarative transaction management.
- ... allow users to implement custom aspects, complementing their use of OOP with AOP.”
Nevertheless Spring AOP framework comes with certain limitations in comparison to a complete AOP implementation, such as AspectJ. The most common problems people encounter while working with Spring AOP framework derive from the fact that Spring AOP is “proxy – based”.
Our recommendation of overcoming the Spring AOP limitations is to use AspectJ weaving. In other words to inject aspect logic directly to the target class and remove the necessity to have all methods being proxied. Read how it is done in this detailed tutorial :