diff --git a/README.md b/README.md index c16a3d3..d93b8db 100644 --- a/README.md +++ b/README.md @@ -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. ``` diff --git a/src/main/java/com/knecon/fforesight/lifecyclecommons/LifecycleAspect.java b/src/main/java/com/knecon/fforesight/lifecyclecommons/LifecycleAspect.java index cf4f5e4..96f4f2e 100644 --- a/src/main/java/com/knecon/fforesight/lifecyclecommons/LifecycleAspect.java +++ b/src/main/java/com/knecon/fforesight/lifecyclecommons/LifecycleAspect.java @@ -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) || " diff --git a/src/main/java/com/knecon/fforesight/lifecyclecommons/LifecycleMonitor.java b/src/main/java/com/knecon/fforesight/lifecyclecommons/LifecycleMonitor.java new file mode 100644 index 0000000..6f0f528 --- /dev/null +++ b/src/main/java/com/knecon/fforesight/lifecyclecommons/LifecycleMonitor.java @@ -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 { + +}