From 11a01480df7348cbfd4e56c1bc63e171f66694af Mon Sep 17 00:00:00 2001 From: Xiaolu Dai Date: Wed, 26 Feb 2020 21:28:05 +0800 Subject: [PATCH] try fix MSI with App Service --- .../config/IncreaseStartupTimeHelper.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 azure-spring-boot-tests/azure-spring-boot-test-application/src/main/java/com/microsoft/azure/config/IncreaseStartupTimeHelper.java diff --git a/azure-spring-boot-tests/azure-spring-boot-test-application/src/main/java/com/microsoft/azure/config/IncreaseStartupTimeHelper.java b/azure-spring-boot-tests/azure-spring-boot-test-application/src/main/java/com/microsoft/azure/config/IncreaseStartupTimeHelper.java new file mode 100644 index 000000000..3c5b5f87f --- /dev/null +++ b/azure-spring-boot-tests/azure-spring-boot-test-application/src/main/java/com/microsoft/azure/config/IncreaseStartupTimeHelper.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See LICENSE in the project root for + * license information. + */ +package com.microsoft.azure.keyvault.spring; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.context.config.ConfigFileApplicationListener; +import org.springframework.boot.env.EnvironmentPostProcessor; +import org.springframework.core.Ordered; +import org.springframework.core.env.ConfigurableEnvironment; + +public class IncreaseStartupTimeHelper implements EnvironmentPostProcessor, Ordered { + + public static final int DEFAULT_ORDER = ConfigFileApplicationListener.DEFAULT_ORDER; + private int order = DEFAULT_ORDER; + + @Override + public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { + try { + Thread.sleep(100_000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @Override + public int getOrder() { + return order; + } + +}