I have some Java annotations of a method, how can I know the order of each annotation aspect? And how I can specify the order of them.
@MyAnnotaion
@Cacheable
@HystrixCommand
public void MYMethod() {}
Cacheable
is from SpringCache and HystrixCommand
is from third party package, and they are both runtime annotations, I need Cacheable
to run before HystrixCommand
, but cannot mark them with @order
.
So, how can I :
1、learn the order of annotation execution?
2、specify the order?
I have tried to search the problem, but if duplicated , please let me know.
you can mark order in enable caching , but this will be application wide setting
@EnableCaching(order=0)
Indicate the ordering of the execution of the caching advisor when multiple advices are applied at a specific joinpoint.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With