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.
- Host: GitHub
- URL: https://github.com/nuraj250/spring-boot-custom-annotation
- Owner: Nuraj250
- Created: 2024-12-24T10:13:36.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-22T08:24:49.000Z (over 1 year ago)
- Last Synced: 2025-02-22T09:37:30.199Z (over 1 year ago)
- Topics: aop, backend, custom-annotation, excution-time, java, logging, spring-boot
- Language: Java
- Homepage:
- Size: 44.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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