Skip to content
The Code Storm
All videos
Spring Boot

Spring Boot AOP: Log Method Execution Time with @Around & a Custom Annotation

Adding start/end timers to every method just to see how long it takes? With Spring AOP you write that logic once and apply it to any method with a single custom annotation: @LogExecutionTime. In this video you'll learn: ✅ Creating a custom @LogExecutionTime annotation ✅ What @Target(ElementType.METHOD) and @Retention(RUNTIME) actually do ✅ Building an Aspect with @Aspect + @Component ✅ Using @Around advice to intercept annotated methods ✅ Measuring and logging execution time around joinPoint.proceed() ✅ The #1 mistake: forgetting proceed() stops your method from running! 💻 Source code: https://github.com/sharathbabugv/tutorial-learn ⏱️ Chapters 0:00 Intro 0:23 Creating the @LogExecutionTime Annotation 0:33 @Target & @Retention Explained 1:37 Building the Aspect with @Around 2:21 Measuring Execution Time 3:01 Why joinPoint.proceed() Is Mandatory 6:02 What Happens If You Skip proceed() 🔔 Subscribe to TheCodeStorm for a weekly dose of Java & Spring Boot: https://www.youtube.com/@the