SPRING CONCEPTS

AOP advice and pointcuts

Spring Concepts / AOP advice and pointcuts

AOP applies additional behaviour to selected method executions.

Understand the idea

The pointcut selects executions, advice is the additional behaviour, and an aspect groups these rules. Spring AOP uses runtime proxies for eligible managed method calls. Around advice calls proceed to execute the wrapped operation and should preserve its return value and exception unless a different contract is deliberate.

A concrete example

@Around("@annotation(com.edupoly.lesson.LogExecutionTime)")

In the application

See the independently runnable examples in Stage 31, Stage 32.

After advice is finally-style; AfterReturning runs only on a normal return.

See it in a working stage

Related concepts

Read the official documentation ↗
Java 21 · Spring Boot 4.1.1 · Edupoly