Service dependencies are registered during subsystem's boot time as follows:...
private InjectedValue<org.wildfly.extension.undertow.ServletContainerService> injectedServletContainerService = new InjectedValue<>();
private InjectedValue<org.wildfly.extension.undertow.Host> injectedHost = new InjectedValue<>();
...
private void deployCoordinatorServlet(final io.undertow.servlet.api.DeploymentInfo deploymentInfo) throws ServletException {
io.undertow.servlet.api.DeploymentManager manager = injectedServletContainerService.getValue().getServletContainer().addDeployment(deploymentInfo);
manager.deploy();
injectedHost.getValue().registerDeployment(deploymentInfo, manager.start());
}
...
...
private final ServiceName hostServiceName = UndertowService.virtualHostName("default-server", "default-host");
private final ServiceName servletContainerServiceName = UndertowService.SERVLET_CONTAINER.append("default");
...
@Override
public void performBoottime(OperationContext context, ModelNode operation, ModelNode model,
ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers)
throws OperationFailedException {
final CoordinatorService coordinatorService = new CoordinatorService();
final ServiceBuilder<CoordinatorService> builder = context.getServiceTarget().addService(RTSSubsystemExtension.COORDINATOR, coordinatorService)
.addDependency(hostServiceName, Host.class, coordinatorService.getInjectedHost())
.addDependency(servletContainerServiceName, ServletContainerService.class, coordinatorService.getInjectedServletContainerService());
...
}
...
Hope I have explained my problem clear enough.
Thanks,
Gytis