jakartaee / cdi

CDI specification
Apache License 2.0
214 stars 78 forks source link

Add the ability to register BuildCompatibleExtension in CDI SE without discovery #813

Open manovotn opened 6 months ago

manovotn commented 6 months ago

Some time ago I realized that while we added build compatible extensions, we didn't allow users to register them in SE programmatically. The only option in SE is to discover them which is unfortunate as you often want a purely synthetic bean archive (to keep it minimal).

The SeContainerInitializer already allows this for portable extensions, see this code. We could easily add an extra method with the same capability.

    public abstract SeContainerInitializer addBuildCompatibleExtensions(Class<? extends BuildCompatibleExtension>... extensions);

Note that I am currently adding the same in Weld under this issue but I really think this should be in spec API.