Skip some CDI extensions with Apache OpenWebBeans
Apache OpenWebBeans is a very modular and flexible CDI implementation. One of its hidden features is to let you control which extensions are active or not. This is particularly needed for short live programs where you want to boost the startup time and you inherit several extensions in (third party) libraries.
As all its configuration, Apache OpenWebBeans let you customize the default extension activation - loading still uses a ServiceLoader - through the property org.apache.webbeans.ignoredExtensions. It takes a list of fully qualified extension names as value and all these extensions will be skipped even if loaded.
You can set it in system properties but it is generally easier to bundle the configuration with your application (in final module/app, not in libraries) adding a META-INF/openwebbeans/openwebbeans.properties file. To select the properties between all the resources found in the classpath - OpenWebBeans configures itself this way too, it uses an ordinal, higher the value is, more important is considered the file and the properties can override less important files ones. If no value is set you will get the default of 100 which will override default configuration when merged.
So in summary, here is a sample configuration skipping two extensions:
configuration.ordinal=101
org.apache.webbeans.ignoredExtensions = \
com.superbiz.HttpExtension,\
com.superbiz.WSExtension
This simple configuration will skip the HttpExtension and WSExtension. Depending what do the extension it can save from milliseconds to seconds during the startup.
From the same author:
In the same category: