AOP frameworks

AspectJ is the most popular AOP framework for Java. AspectJ provides compile-time weaving. We can add the AspectJ compiler to our build process to do the weaving.

Spring AOP provides integration with AspectJ and a few basic AOP features of its own, and also Spring AOP does runtime weaving. It is simpler to use, but you can only intercept method calls on Spring beans.

Spring AOP does not aim to compete with AspectJ. Choosing between Spring AOP and AspectJ depends on your context.

If you are working with Spring beans and want to intercept method calls on Spring beans, then Spring AOP is sufficient. If you want to intercept method calls on objects that are not managed by the Spring container, you will need to use the complete AOP framework—AspectJ.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset