An open API service indexing awesome lists of open source software.

https://github.com/nuraj250/spring-boot-custom-annotation

Spring Boot example demonstrating the creation and use of a custom annotation with AOP to log method execution times.
https://github.com/nuraj250/spring-boot-custom-annotation

aop backend custom-annotation excution-time java logging spring-boot

Last synced: 2 months ago
JSON representation

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

Awesome Lists containing this project

README

          

# 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:
```bash
git clone https://github.com/Nuraj250/spring-boot-custom-annotation.git