Hi,
I would like to be able to annotate my services with a custom annotation, and run some AOP-like code only on those methods. I know I can do this with standard AOP and @Apsect annotations, but instead of defining in the aspect itself (or xml) which methods will be intercepted, I want to define it in every method I need, to have more visibility when coding and reviewing/code maintenance.
An example would be to perform some lock checking on specific methods. I would like to do the following
@Lockable
public void performBankTransaction(....)
And because that method is annotated with @Lockable, execute some code before it (that would lock based on some condition).
As a super bonus, I would also like to be able to annotate a parameter in the method to control concurrency, like so:
@Lockable
public void performBankTransaction(@LockId Account from, Account to)
would lock on the method using the 'from' field only (and my code knows how to lock based on that).
I tried doing some searches for this but I'm having a hard time figuring out the correct keywords, as "annotations" / custom AOP etc lead me to all the standard pages.
Any help would be much appreciated
Thanks in advance
AB



Reply With Quote
