Spring AOP(Aspect Oriented Programming) Tutorials
Hi friends, let us see the importance of Spring AOP(Aspect Oriented Programming), very very important module of spring framework. In the enterprise level application programming we used to add different cross-cutting functionalities [cross-cutting functionalities means adding different types of services to the application at runtime automatically ]
See in the above example, we are using 3 cross-cutting functionalities [ authentication,logging,transaction ] in 2 methods. If we are going to do any modifications in logging service we need to modify 2 times right ? may be 100 times if we wrote in 100 methods which is very difficult. If i want to remove one service we need to open class file and delete the required things and need recompile, re-deploy needed.
So to avoid this, in spring AOP we can add these cross-cutting functionalities at run time i mean we can separate the services [ cross-cutting functionalities ] and our client logic.
So that our class length will be decreased.
- While implementing business logic for real time applications, apart from business logic some other services also will be added to make that as enterprise level one.
- According to spring, the services that are overlapping on the business logic are called as cross-cutting functionalities, we already saw the drawbacks of implementing business logic + services.
- In order to overcome the above problems, we need to separate the business logic and the services, we call this process of separation as AOP, Using AOP the business logic and cross-cutting functionalities are implemented separately and executed at run time as combine.