There are some important terms in Spring AOP which we need to know about. All total there are 8 terms which are as follows :
1. Aspect
2. Advice
3. JoinPoint
4. PointCut
5. Advisor
6. Target
7. Proxy
8. Weaving

Aspect : It is one of the main concept in AOP which is programmatically represented as Middle Level Services(Sercurity, transaction, log etc) . Advices are applied to the Aspect.

For ex- Aspects are the middle level services like SecurityService, LogService, TransactionService etc are applied to the three JoinPoints of the Business Logic through Advices. 

Advice :  It is the required implementation of the Middle Level Services which tells about the method execution of different Aspects at the joinPoint. 
Advice is a Java class which contains the information about the execution of method of Middle level services at the different joinPoints. So basically it tells the container what to execute?  


JoinPoint : It is point or concept which tells where we want to apply Advice. It tells container when to execute?
Basically there are three joinPoints are provided by the Spring AOP i.e

1. Method Before 
2. Method Returning 
3. Method Throwing  

a) Method Before : It tell the container to execute the codes before the core logic to be execute. It is provided by the Spring in the form of a method called Before() present in the MethodBeforeAdvice interface.

b) Method Returning : It tells the container to execute the codes after successfully returning the control from the core logic. It is iimplemented using methodAfterReturning() method present in the methodAfterReturningAdvice interface.

c) Method Throwing : It tells the container to execute the codes when container throws execution while executing the core logic. It is implemented using methodAfterThrowing() method provided in the ThrowsAdvice interface. 

PointCut : It is the collection of JoinPoints. Previously JoinPoints are common for all core logic but now with the pointCut we have the option to tell Container to apply which JoinPoints to which core logics. 

Advisor : For telling the Container to apply these JoinPoints to the selected core logic we need joinPoint and Advice to configure in a Advisor. So Advisor is a collection of both JoinPoints and PointCuts. 

Target : It is the main object of our Business Service before applying the Advices or Advisors.It will directly call and execute the codes of core logic. 

Proxy : It is an object of our business service after applying Advices or Advisors. Calling the core logic with the Proxy calls the dynamic code generated by the Container which contains advices with the core logic. 

Weaving : It is the process of applying the Advice/Advisor to the target objects at given PointCuts to get the proxy objects. 




AOP is termed as Aspect Oriented Programming. Spring AOP is a concept which overcomes the limitations with the simple OOPs concepts. It is a new kind of programming technique which gives the facility to add the functionality dynamically. Here Spring Container is responsible to generating and executing the code dynamically, only we need to configure in the XML or through Annotation. Technically Middle Level Services termed as Aspect and practically we are Aspects to the main business logics at the joinPoints.

For ex- Let suppose if we have a business logic i.e deposit() and we are supposed to apply some middle level services to this business logic at the JoinPoints. 

Now the Question arises is where to apply Advices ?
Basically Advices are applied to three points , they are termed as JoinPoints. So there are Three joinPoints where we can apply Advice( Middle level services).

Comparison of Technical terms of AOP with the practical view

Aspect Middle Level Services
Advice Implementation of Middle Level Services
JoinPoints Where to Apply Advices?

Some of the Spring AOP Terminology we need to know
1. Aspect
2. Advice
3. JoinPoints
4. PointCut
5. Advisor
6. Target
7.  Proxy
8. Weaving.

Business Services -> It is the common services we come across in distributed applications.
Like CustomerServices , AccountServices etc.
It contains the set of Business Logic.

Business Services = set of Business Logics.

Business Logic -> It the main logic which is to be performed and it contains set of business operations.
For Example deposit(), withdraw(), getBalance() are the business logics under some business Services.
Advices are applied to the Business logic.

Business Logic = Set of business Operations

Some of the Advice/ Middle Level Services that we are attaching with the Aspects ( Business Logic ) are
Security Service , Transaction Service , log Service etc.

Spring provides three way to implement the Spring AOP :
1. Using Spring API based AOP ( 1.0 )
2. Using Spring Annotation based AOP ( 2.0 ) - > Recommended to use
3. Using XML schema based AOP ( 2.0 ) 

Ads 468x60px

.

Ads

.

Featured Posts

Popular Posts

Like Us On FaceBook

Total Pageviews

Online Members

Live Traffic