Spring post processors, order, @Required
-
11-10-2019 - |
Question
At work we have a custom ServiceProvider pattern with an annotation for binding services with a spring post-processor.
I wonder if i can check if my binding was correctly done, by using @Required.
The binding is not done by Spring (neither xml or autowiring).
I guess if it's possible, the post processor order has some importance (spring checking required should be processed after our custom binding processor).
Can someone tell me if it's possible and how?
Solution
RequiredAnnotationBeanPostProcessor
is a PriorityOrdered
with order value Integer.MAX_VALUE - 1
. Threrefore your postprocessor need to implement PriorityOrdered
with the lesser order value to be fired before RequiredAnnotationBeanPostProcessor
.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow