Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[config-dev] What priority means in Jakarta


Further to today's discussion, I spent a bit more time looking at the usage in CDI and try to recall what we discussed in the past regarding priority understanding. For priority used for overwrite reasons, such as converter and configsources.

We mainly discussed the invocation order for interceptors etc. No example was found on overwrite purpose as we used in Config.

I did further digging and found in CDI spec, the following explains clearly that highest priority wins.

https://jakarta.ee/specifications/cdi/3.0/jakarta-cdi-spec-3.0.html#unsatisfied_and_ambig_dependencies

All the beans left are alternatives with a priority, or producer methods or fields of beans that are alternatives with a priority, then the container will determine the highest priority value, and eliminate all beans, except for alternatives with the highest priority and producer methods and fields of alternatives with the highest priority value. If there is exactly one bean remaining, the container will select this bean, and the ambiguous dependency is called resolvable.

The above sentence clearly says the highest priority wins. MP Config priority is consistent with this behaviour.

--
Thanks
Emily


Back to the top