Class DeltaSpikeConfigBootstrap
- All Implemented Interfaces:
jakarta.enterprise.inject.spi.Extension
DeltaSpike's JMX MBeanExtension observes BeforeBeanDiscovery
and, during that callback, resolves the DeltaSpike ProjectStage via
ConfigResolver.getConfigProvider(). That method discovers its
ConfigProvider implementation with ServiceLoader against the
thread context classloader. When this add-on's WAR is nested inside
an EAR, the TCCL active during CDI bootstrap is the EAR (parent) classloader,
which cannot see deltaspike-core-impl in the WAR's WEB-INF/lib.
The lookup then finds no provider and deployment fails with
java.lang.RuntimeException: Could not load ConfigProvider.
This extension primes and caches the ConfigProvider early, while the
TCCL is set to this class's classloader (the WAR module classloader, which can
see WEB-INF/lib). ConfigResolver caches the provider in a
static field, so DeltaSpike's later lookup returns the cached instance and
never re-runs the failing ServiceLoader scan. DeltaSpike stays in the
WAR, so runtime bean resolution is unaffected.
Ordering: Weld instantiates all extensions (their constructors) before firing
BeforeBeanDiscovery, so the constructor below is guaranteed to run
before DeltaSpike's MBeanExtension.init. The high-priority observer is
a defensive fallback. The priming is a no-op cost (one cached lookup) for
standalone WAR deployments, where the problem does not occur.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
DeltaSpikeConfigBootstrap
public DeltaSpikeConfigBootstrap()
-