diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index af1fe52..b68b5c8 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -235,6 +235,11 @@ public function discoverServiceProviders() {
     $module_filenames = $this->getModuleFileNames();
     $this->registerNamespaces($this->getModuleNamespaces($module_filenames));
 
+    // Add site specific or test namespaces.
+    if (!empty($GLOBALS['settings']['container_namespaces'])) {
+      $this->registerNamespaces($GLOBALS['settings']['container_namespaces']);
+    }
+
     // Load each module's serviceProvider class.
     foreach ($this->moduleList as $module => $weight) {
       $camelized = ContainerBuilder::camelize($module);
