Add LifecycleMonitor annotation

This commit is contained in:
Andrei Isvoran 2024-07-04 10:16:46 +03:00
parent 43a28fe596
commit 1842870e69
3 changed files with 15 additions and 0 deletions

View File

@ -14,6 +14,8 @@ lifecycle:
base-package: com.knecon.fforesight
```
You also need to enable aspectj in your application main class via the annotation `@EnableAspectJAutoProxy`
The code will scan all requests from methods that are inside the specified package and that are annotated with one of the annotations present in the `LifecycleAspect` class.
```

View File

@ -21,6 +21,7 @@ public class LifecycleAspect {
@Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitListener) || "
+ "@annotation(com.knecon.fforesight.lifecyclecommons.LifecycleMonitor) || "
+ "@annotation(org.springframework.web.bind.annotation.GetMapping) || "
+ "@annotation(org.springframework.web.bind.annotation.PostMapping) || "
+ "@annotation(org.springframework.web.bind.annotation.PutMapping) || "

View File

@ -0,0 +1,12 @@
package com.knecon.fforesight.lifecyclecommons;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface LifecycleMonitor {
}