Besides Dependency Injection (DI), another core feature that the Spring Framework brings to the developer community is Aspect-Oriented Programming (AOP). Although it used to be difficult to learn, understand, and implement, thanks to Spring’s intensive use of AOP within the framework and a simplified AOP programming model that Spring provides, AOP has become a technique that developers use on day-to-day development, especially when developing Spring-based applications. AOP is often referred to as a tool for implementing crosscutting concerns. When you “cut through” the unfamiliar terminology, you use AOP for modularizing individual pieces of logic, known as concerns, and you apply these concerns to many parts of an application. Logging and security are typical examples of crosscutting concerns that are present in many applications. Consider an application that logs the start and end of every method for debugging purposes. You will probably refactor the logging code into a special class, but you still have to call methods on that class twice per method in your application in order to perform the logging. Using AOP, you can simply specify that you want the methods on your logging class to be invoked before and after each method call in your application.
KeywordsRegular Expression Static Check Runtime Overhead Advice Type Method Method
Unable to display preview. Download preview PDF.