Skip to content

Commit 9bff154

Browse files
author
Ramachandran Nellaiyappan
committed
[feat] #1 spring actuator added to monitor application health
1 parent 172c907 commit 9bff154

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
<artifactId>spring-boot-starter-web</artifactId>
2828
</dependency>
2929

30+
<dependency>
31+
<groupId>org.springframework.boot</groupId>
32+
<artifactId>spring-boot-starter-actuator</artifactId>
33+
</dependency>
34+
3035
<dependency>
3136
<groupId>org.springframework.boot</groupId>
3237
<artifactId>spring-boot-devtools</artifactId>

src/test/java/com/github/nramc/dev/journey/api/JourneyApiApplicationTests.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,24 @@
55
import org.springframework.beans.factory.annotation.Autowired;
66
import org.springframework.boot.test.context.SpringBootTest;
77
import org.springframework.context.ApplicationContext;
8+
import org.springframework.test.web.reactive.server.WebTestClient;
89

9-
@SpringBootTest
10+
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
1011
class JourneyApiApplicationTests {
1112
@Autowired
1213
private ApplicationContext applicationContext;
14+
@Autowired
15+
private WebTestClient webTestClient;
1316

1417
@Test
1518
void contextLoads() {
1619
Assertions.assertNotNull(applicationContext);
1720
}
1821

22+
@Test
23+
void testHealthCheckEndpoint() {
24+
webTestClient.get().uri("/actuator/health").exchange()
25+
.expectStatus().isOk();
26+
}
27+
1928
}

0 commit comments

Comments
 (0)