Java annotation execution order

I have some Java method annotations, how can I find out the order of each aspect of the annotation? And how can I indicate their order.

@MyAnnotaion @Cacheable @HystrixCommand public void MYMethod() {} 

Cacheable is from SpringCache, and HystrixCommand is from a third-party package, and they are runtime annotations, I need Cacheable to run before HystrixCommand , but I cannot tag them with @order .

So how can I:

1, find out the annotation order?

2, specify the order?

I tried to find the problem, but if duplicating it, let me know.

+5
source share
1 answer

you can mark the order in caching permission , but this will be the installation of the application.

 @EnableCaching(order=0) 

Specify the order of execution of the caching adviser when several tips are applied at a specific connection point.

+1
source

Source: https://habr.com/ru/post/1259581/


All Articles