O'Reilly logo

Beginning Spring Framework 2 by Christian Dupuis, Naveen Balani, Thomas Van de Velde, Anne Horton, Sing Li, Bruce Snyder

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 12. Spring AOP and AspectJ

Over the last seven years or so, aspect-oriented programming (AOP) has emerged as a superior programming methodology. AOP addresses the pieces of a system that cannot be modularized with object-oriented programming (OOP) alone. As described by Ramnivas Laddad in his excellent book, AspectJ In Action:

In the evolutionary view of programming methodology, procedural programming introduced functional abstraction, OOP introduced object abstraction, and now AOP introduces concern abstraction.

This chapter will help you understand AOP and begin to apply it though the use of the Spring framework. By the end of this chapter, you will:

  • Recognize the differences between AOP and OOP

  • Comprehend the core concepts and terminology of AOP

  • Understand how Spring AOP uses AspectJ

  • Know the features of Spring AOP

  • Be able to apply Spring AOP

So let's get started by comparing some concepts within AOP and OOP.

Comparing Aspect-Oriented Programming to Object-Oriented Programming

Object-oriented programming (OOP) has been around for many years and has been very successful. After all, the Java programming language is based on OOP concepts. One of the major goals of OOP was to provide improved maintainability and reusability. OOP dramatically improved the modularity and reusability of applications through such concepts as encapsulation, inheritance, and polymorphism. It made possible a new level of modularity using these concepts. However, situations still exist where OOP solutions ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required