Spring Aspect oriented programming (AOP)

Spring Aspect Oriented Programming (AOP) is one of the key feature of Spring framework. AOP breaks down complete code into multiple modules. 

AOP is similar to OOPS concept where it breaks code into multiple reusable modules.

AOP provides the capability to dynamically add module at runtime.

Cross-cutting concerns are parts of a program that rely on or must affect many other parts of the system. This is like injecting complete module(logging, cahcing, etc ) in Spring framework dynamically.

Logging, caching, security, monitoring, etc. are some of the examples cross cutting concern from AOP. At any point of time there modules can be added dynamically.

Spring AOP has interceptors which can intercept application and its methods. This is to perform some extra action at the time of property initiation, method initialization or destroy. 

AOP terminologies

Below are some of the important terminologies to understand more about AOP:

Aspect

Aspect is a concern which is require to implement in Spring framework or application. An application can have multiple aspects such as logging, security, monitoring.

Join Point

The is a point where concern or Aspect gets plugin. 

Advice

It is an actual implementation of aspect. Advice is to suggest at what moment we need to execute code, either before or after method execution.

Advice can be execute at below point of time:

  1. At the time of function exception
  2. Before method execution
  3. After method execution
  4. Method throws as exception

Pointcut

Join points where an advice should be executed. 

Introduction

Allows you to add new methods or attributes to the existing classes.

Target object

This is an application object on which the advice will be applied.

Weaving

It is a technique to make a connection in between aspects at load time, compile time or runtime.

Imran Khan

Specialist Master (Architect) with a passion for cutting-edge technologies like AEM (Adobe Experience Manager) and a proven track record of delivering high-quality software solutions.

  • Languages: Java, Python
  • Frameworks: J2EE, Spring, Struts 2.0, Hibernate
  • Web Technologies: React, HTML, CSS
  • Analytics: Adobe Analytics
  • Tools & Technologies: IntelliJ, JIRA

🌐 LinkedIn

📝 Blogs

📧 Imran Khan