Do not rely on boot module loader for finding module dependencies

The `Module.getBootModuleLoader()` API may be deprecated at some point, so use a safer alternative.

Closes #28448

Signed-off-by: David M. Lloyd <david.lloyd@redhat.com>
This commit is contained in:
David M. Lloyd 2024-04-04 12:20:43 -05:00 committed by GitHub
parent 54af571f1e
commit b5535ac970
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View file

@ -61,7 +61,10 @@ public abstract class KeycloakDependencyProcessor implements DeploymentUnitProce
} }
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
final ModuleLoader moduleLoader = Module.getBootModuleLoader(); ModuleLoader moduleLoader = Module.getCallerModuleLoader();
if (moduleLoader == null) {
moduleLoader = Module.getSystemModuleLoader();
}
addCommonModules(moduleSpecification, moduleLoader); addCommonModules(moduleSpecification, moduleLoader);
addPlatformSpecificModules(phaseContext, moduleSpecification, moduleLoader); addPlatformSpecificModules(phaseContext, moduleSpecification, moduleLoader);
} }

View file

@ -63,7 +63,10 @@ public abstract class KeycloakDependencyProcessor implements DeploymentUnitProce
// Next phase, need to detect if this is a Keycloak deployment. If not, don't add the modules. // Next phase, need to detect if this is a Keycloak deployment. If not, don't add the modules.
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
final ModuleLoader moduleLoader = Module.getBootModuleLoader(); ModuleLoader moduleLoader = Module.getCallerModuleLoader();
if (moduleLoader == null) {
moduleLoader = Module.getSystemModuleLoader();
}
addCoreModules(moduleSpecification, moduleLoader); addCoreModules(moduleSpecification, moduleLoader);
addCommonModules(moduleSpecification, moduleLoader); addCommonModules(moduleSpecification, moduleLoader);