diff --git a/src/main/java/io/openliberty/guides/startup/StartupDelay.java b/src/main/java/io/openliberty/guides/startup/StartupDelay.java new file mode 100644 index 00000000..14c0e3c1 --- /dev/null +++ b/src/main/java/io/openliberty/guides/startup/StartupDelay.java @@ -0,0 +1,18 @@ +package io.openliberty.guides.startup; + +import javax.annotation.PostConstruct; +import javax.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class StartupDelay { + + @PostConstruct + public void delay() { + try { + System.out.println("== STARTUP DELAY: Sleeping for 30 seconds =="); + Thread.sleep(60000); // 30 sec delay + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } +} diff --git a/src/main/java/io/openliberty/sample/system/SystemConfig.java b/src/main/java/io/openliberty/sample/system/SystemConfig.java index 17be711b..672d9e8f 100644 --- a/src/main/java/io/openliberty/sample/system/SystemConfig.java +++ b/src/main/java/io/openliberty/sample/system/SystemConfig.java @@ -20,6 +20,16 @@ @ApplicationScoped public class SystemConfig { + @PostConstruct + public void delay() { + try { + System.out.println("== STARTUP DELAY: Sleeping for 30 seconds =="); + Thread.sleep(60000); // 30 sec delay + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } + @Inject @ConfigProperty(name = "io_openliberty_sample_system_inMaintenance") Provider inMaintenance; diff --git a/src/main/resources/META-INF/beans.xml b/src/main/resources/META-INF/beans.xml new file mode 100644 index 00000000..e901ee5e --- /dev/null +++ b/src/main/resources/META-INF/beans.xml @@ -0,0 +1,5 @@ + +