diff --git a/apps/encryption/appinfo/app.php b/apps/encryption/appinfo/app.php
index 1b5f18813c310958ceca2bfbaca711ee4acece90..66127e5f975e83c29533b109dc1dab8b5d856e28 100644
--- a/apps/encryption/appinfo/app.php
+++ b/apps/encryption/appinfo/app.php
@@ -27,12 +27,13 @@ namespace OCA\Encryption\AppInfo;
 
 \OCP\Util::addscript('encryption', 'encryption');
 
-$encryptionSystemReady = \OC::$server->getEncryptionManager()->isReady();
+$encryptionManager = \OC::$server->getEncryptionManager();
+$encryptionSystemReady = $encryptionManager->isReady();
 
 /** @var Application $app */
 $app = \OC::$server->query(Application::class);
 if ($encryptionSystemReady) {
-	$app->registerEncryptionModule();
-	$app->registerHooks();
-	$app->setUp();
+	$app->registerEncryptionModule($encryptionManager);
+	$app->registerHooks(\OC::$server->getConfig());
+	$app->setUp($encryptionManager);
 }
diff --git a/apps/encryption/lib/AppInfo/Application.php b/apps/encryption/lib/AppInfo/Application.php
index a5cbb30870cf4795289c21c36a9c3ef83ad1d823..6674abc972d0d9aae0e72c8ad6cba17bbe6bd855 100644
--- a/apps/encryption/lib/AppInfo/Application.php
+++ b/apps/encryption/lib/AppInfo/Application.php
@@ -44,23 +44,15 @@ use OCP\Encryption\IManager;
 use OCP\IConfig;
 
 class Application extends \OCP\AppFramework\App {
-
-	/** @var IManager */
-	private $encryptionManager;
-	/** @var IConfig */
-	private $config;
-
 	/**
 	 * @param array $urlParams
 	 */
 	public function __construct($urlParams = []) {
 		parent::__construct('encryption', $urlParams);
-		$this->encryptionManager = \OC::$server->getEncryptionManager();
-		$this->config = \OC::$server->getConfig();
 	}
 
-	public function setUp() {
-		if ($this->encryptionManager->isEnabled()) {
+	public function setUp(IManager $encryptionManager) {
+		if ($encryptionManager->isEnabled()) {
 			/** @var Setup $setup */
 			$setup = $this->getContainer()->query(Setup::class);
 			$setup->setupSystem();
@@ -70,8 +62,8 @@ class Application extends \OCP\AppFramework\App {
 	/**
 	 * register hooks
 	 */
-	public function registerHooks() {
-		if (!$this->config->getSystemValueBool('maintenance')) {
+	public function registerHooks(IConfig $config) {
+		if (!$config->getSystemValueBool('maintenance')) {
 			$container = $this->getContainer();
 			$server = $container->getServer();
 			// Register our hooks and fire them.
@@ -96,11 +88,10 @@ class Application extends \OCP\AppFramework\App {
 		}
 	}
 
-	public function registerEncryptionModule() {
+	public function registerEncryptionModule(IManager $encryptionManager) {
 		$container = $this->getContainer();
 
-
-		$this->encryptionManager->registerEncryptionModule(
+		$encryptionManager->registerEncryptionModule(
 			Encryption::ID,
 			Encryption::DISPLAY_NAME,
 			function () use ($container) {
diff --git a/tests/lib/Traits/EncryptionTrait.php b/tests/lib/Traits/EncryptionTrait.php
index 5ac63c54a5a6aa2db79cdf3a416f1609fe57b4da..38ba18fdfbb14a58e516104365c8aab3063649e2 100644
--- a/tests/lib/Traits/EncryptionTrait.php
+++ b/tests/lib/Traits/EncryptionTrait.php
@@ -14,6 +14,7 @@ use OC\Memcache\ArrayCache;
 use OCA\Encryption\AppInfo\Application;
 use OCA\Encryption\KeyManager;
 use OCA\Encryption\Users\Setup;
+use OCP\Encryption\IManager;
 
 /**
  * Enables encryption
@@ -64,7 +65,8 @@ trait EncryptionTrait {
 		/** @var Setup $userSetup */
 		$userSetup = $container->query(Setup::class);
 		$userSetup->setupUser($name, $password);
-		$this->encryptionApp->setUp();
+		$encryptionManager = $container->query(IManager::class);
+		$this->encryptionApp->setUp($encryptionManager);
 		$keyManager->init($name, $password);
 	}