diff --git a/lib/private/appframework/dependencyinjection/dicontainer.php b/lib/private/appframework/dependencyinjection/dicontainer.php
index 4821ecaf67b74f918f4619a6ccf874497e925c53..78224ea54c0ec9fbe5c1665b64dd59623d6b4994 100644
--- a/lib/private/appframework/dependencyinjection/dicontainer.php
+++ b/lib/private/appframework/dependencyinjection/dicontainer.php
@@ -98,7 +98,7 @@ class DIContainer extends SimpleContainer implements IAppContainer{
 			$dispatcher->registerMiddleware($c['SecurityMiddleware']);
 
 			foreach($middleWares as $middleWare) {
-				$dispatcher->registerMiddleware($middleWare);
+				$dispatcher->registerMiddleware($c[$middleWare]);
 			}
 
 			return $dispatcher;
@@ -133,10 +133,10 @@ class DIContainer extends SimpleContainer implements IAppContainer{
 	}
 
 	/**
-	 * @param Middleware $middleWare
+	 * @param string $middleWare
 	 * @return boolean|null
 	 */
-	function registerMiddleWare(Middleware $middleWare) {
+	function registerMiddleWare($middleWare) {
 		array_push($this->middleWares, $middleWare);
 	}
 
diff --git a/lib/public/appframework/iappcontainer.php b/lib/public/appframework/iappcontainer.php
index e4f5f37cad233e47e67b3aadd30cb1d07346d4ca..a0b0c06881a856fdd88d7f8b055670de1dc16946 100644
--- a/lib/public/appframework/iappcontainer.php
+++ b/lib/public/appframework/iappcontainer.php
@@ -50,10 +50,10 @@ interface IAppContainer extends IContainer{
 	function getServer();
 
 	/**
-	 * @param Middleware $middleWare
+	 * @param string $middleWare
 	 * @return boolean
 	 */
-	function registerMiddleWare(Middleware $middleWare);
+	function registerMiddleWare($middleWare);
 
 	/**
 	 * @return boolean