protected void setRegistryService(RegistryService registryService) {
    PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext();
    carbonContext.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
    carbonContext.setTenantId(MultitenantConstants.SUPER_TENANT_ID);

    CommonUtil.setRegistryService(registryService);
    // Generate LCM search query if it doesn't exist.
    try {
      CommonUtil.addDefaultLifecyclesIfNotAvailable(
          registryService.getConfigSystemRegistry(),
          registryService.getRegistry(CarbonConstants.REGISTRY_SYSTEM_USERNAME));
    } catch (Exception e) {
      log.error("An error occurred while setting up Governance Life Cycle Management", e);
    }
  }