Skip to content

Commit

Permalink
Add web and actuator starters
Browse files Browse the repository at this point in the history
This commit also adds sleep to ApplicationListener.onApplicationEvent() to see if it's blocking application start-up.

See spring-projects/spring-framework#25074 (comment)
  • Loading branch information
izeye committed May 14, 2020
1 parent 5ecd8d7 commit 108d4cc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Expand Up @@ -32,6 +32,8 @@ repositories {
}

dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-jdbc")
implementation("com.h2database:h2")

Expand Down
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;

import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
Expand All @@ -25,6 +26,13 @@ public WarmUpApplicationListener(TestRepository testRepository) {
public void onApplicationEvent(ApplicationStartedEvent event) {
log.info("In onApplicationEvent(): {}", event);

try {
TimeUnit.SECONDS.sleep(10);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
throw new RuntimeException(ex);
}

List<String> ids = Arrays.asList("test1", "test2");
List<Thread> threads = new ArrayList<>();
ids.forEach((id) -> {
Expand Down

0 comments on commit 108d4cc

Please sign in to comment.