What I want to do is to create a custom annotation to use it on a Service, and each time a method is called from there first execute something. For example:
@CustomAnnotation
public Class MyService{
public void myMethod(){
//do something
}
}
And when myMethod is called, do something before its code is executed, and then do what it has to do. Is there any way to do that? I need to do it with annotations, using interfaces or inheritance for that is useless because is for each method, not just one.
I know how to scan a package to get the classes annotated, but I don't know how to check it at runtime when the app is running.
Thank you!