Skip to content

Spring Boot example demonstrating the creation and use of a custom annotation with AOP to log method execution times.

Notifications You must be signed in to change notification settings

Nuraj250/spring-boot-custom-annotation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot Custom Annotation

This repository demonstrates how to create and use a custom annotation in a Spring Boot application. The custom annotation @LogExecutionTime is used to measure and log the execution time of methods, leveraging Spring's Aspect-Oriented Programming (AOP) capabilities.

Features

  • Define custom annotations for reusable logic.
  • Implement an aspect for method execution time logging.
  • Example integration with a Spring Boot service and REST controller.

Use Case

The @LogExecutionTime annotation can be applied to any method, and it will automatically log the execution time of that method without modifying its business logic.

Key Components

  1. Custom Annotation

    • Annotation: @LogExecutionTime
    • Scope: Method-level.
  2. Aspect

    • Logs the execution time of annotated methods using Spring AOP.
  3. Example Application

    • A sample service and REST controller demonstrate the usage of the custom annotation.

How to Run

  1. Clone the repository:
    git clone https://github.com/Nuraj250/spring-boot-custom-annotation.git

About

Spring Boot example demonstrating the creation and use of a custom annotation with AOP to log method execution times.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages