Followed the blog http://briansjavablog.blogspot.in/2013/04/spring-aop-tutorial.html
Really amazing to learn this concept very clearly.
Spring AOP Tutorial
Introduction
Application logic can be broken into 2 distinct areas, core business logic and cross cutting concerns. Business logic is code written to satisfy a functional requirement, while a cross cutting concern is 'utility' logic that is agnostic to any specific business process and required by many parts of the application. Examples include logging, transaction management, performance monitoring and security. While none of these address a functional requirement, they remain fundamental parts of the application runtime.
Cross cutting concerns present 2 main challenges.
Application logic can be broken into 2 distinct areas, core business logic and cross cutting concerns. Business logic is code written to satisfy a functional requirement, while a cross cutting concern is 'utility' logic that is agnostic to any specific business process and required by many parts of the application. Examples include logging, transaction management, performance monitoring and security. While none of these address a functional requirement, they remain fundamental parts of the application runtime.
Cross cutting concerns present 2 main challenges.
- They tend to be 'scattered' across the application which can lead to considerable duplicate code. Logging or performance monitoring is a good example.
- They become tangled with application business logic and result in code that is difficult to maintain because there is no clear Separation of Concerns.
Key Terms
The detailed inner workings of AOP is well beyond the scope of this post. However, I've provided a brief definition of key terms that are referred to throughout this tutorial.
Aspect - A self contained module that attempts to address a specific cross cutting concern. In this tutorial the Aspect will contain performance monitoring functionality.
Advice - Logic that is invoked at a specific point in a programs execution.
Join Point - A specific point in a programs execution where advice is applied. Note that advice can be applied before and after a Join Point.
Pointcut - An expression that identifies Join Points matching certain criteria. For example we can define a Pointcut that identifies all public methods in a package. These specific points in program execution (JoinPoints) have advice applied to them at runtime.
Implementation will discuss in next blog...