Skip to content

Commit

Permalink
fixed bug in legacy ejb-jar scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
lprimak committed Nov 21, 2024
1 parent a283717 commit 61c4079
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,11 @@ private WeldBootstrap ensureWeldBootstrapCreated(DeploymentContext context, Appl
return bootstrap;
}

private void registerServices(DeploymentImpl deploymentImpl) {
private void registerServices(DeploymentImpl deploymentImpl, RootBeanDeploymentArchive rootBDA) {
for (var entry : bundleToBeanDeploymentArchive.entrySet()) {
if (deploymentImpl.getBeanDeploymentArchives().contains(entry.getValue())) {
var bundle = entry.getKey();
var beanDeploymentArchive = deploymentImpl.getRootBDAs().iterator().next().moduleBda;
var beanDeploymentArchive = rootBDA == null ? entry.getValue() : rootBDA.moduleBda;

if (!beanDeploymentArchive.getBeansXml().getBeanDiscoveryMode().equals(NONE)) {

Expand Down Expand Up @@ -526,7 +526,7 @@ private void processApplicationLoaded(ApplicationInfo applicationInfo) {
DeploymentImpl.currentDeploymentContext.set(rootBDA.context);
try {
DeploymentImpl filtered = deploymentImpl.filter(rootBDA, applicationInfo);
completeDeployment(filtered);
completeDeployment(filtered, filtered.getRootBDAs().iterator().next());
WeldBootstrap bootstrap = filtered.context.getTransientAppMetaData(WELD_BOOTSTRAP, WeldBootstrap.class);
startWeldBootstrap(applicationInfo, rootBDA, bootstrap, filtered, componentInvocation);
} finally {
Expand All @@ -536,7 +536,7 @@ private void processApplicationLoaded(ApplicationInfo applicationInfo) {
}
}
} else if (!deploymentImpl.getRootBDAs().isEmpty()) {
completeDeployment(deploymentImpl);
completeDeployment(deploymentImpl, null);
// Legacy EJB-Jar scenario, one Weld instance per EAR
RootBeanDeploymentArchive bda = deploymentImpl.getRootBDAs().iterator().next();
WeldBootstrap bootstrap = unifyBootstrap(bda, applicationInfo);
Expand All @@ -563,8 +563,8 @@ private void processApplicationLoaded(ApplicationInfo applicationInfo) {
}
}

private void completeDeployment(DeploymentImpl deploymentImpl) {
registerServices(deploymentImpl);
private void completeDeployment(DeploymentImpl deploymentImpl, RootBeanDeploymentArchive rootBDA) {
registerServices(deploymentImpl, rootBDA);
deploymentImpl.buildDeploymentGraph();

Set<BeanDeploymentArchive> archives = deploymentImpl.getBeanDeploymentArchives();
Expand Down

0 comments on commit 61c4079

Please sign in to comment.