Skip to content

Commit 20d34ec

Browse files
committed
pom files updated
1 parent 030643b commit 20d34ec

File tree

5 files changed

+179
-158
lines changed

5 files changed

+179
-158
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,73 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4-
<modelVersion>4.0.0</modelVersion>
5-
<parent>
6-
<groupId>org.springframework.boot</groupId>
7-
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>3.4.4</version>
9-
<relativePath/> <!-- lookup parent from repository -->
10-
</parent>
11-
<groupId>com.learning</groupId>
12-
<artifactId>contextservice</artifactId>
13-
<version>0.0.1-SNAPSHOT</version>
14-
<name>contextservice</name>
15-
<description>contextservice</description>
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>org.springframework.boot</groupId>
7+
<artifactId>spring-boot-starter-parent</artifactId>
8+
<version>3.4.4</version>
9+
<relativePath/> </parent>
10+
<groupId>com.learning</groupId>
11+
<artifactId>contextservice</artifactId>
12+
<version>0.0.1-SNAPSHOT</version>
13+
<name>contextservice</name>
14+
<description>contextservice</description>
1615

17-
<properties>
18-
<java.version>21</java.version>
19-
<spring-cloud.version>2024.0.1</spring-cloud.version>
20-
</properties>
21-
<dependencies>
22-
<dependency>
23-
<groupId>org.springframework.boot</groupId>
24-
<artifactId>spring-boot-starter-web</artifactId>
25-
</dependency>
16+
<properties>
17+
<spring-cloud.version>2024.0.1</spring-cloud.version>
18+
</properties>
19+
<dependencies>
20+
<dependency>
21+
<groupId>org.springframework.boot</groupId>
22+
<artifactId>spring-boot-starter-web</artifactId>
23+
</dependency>
2624
<dependency>
2725
<groupId>org.projectlombok</groupId>
2826
<artifactId>lombok</artifactId>
2927
<version>1.18.38</version>
3028
<scope>provided</scope>
3129
</dependency>
32-
<dependency>
33-
<groupId>org.springframework.cloud</groupId>
34-
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
35-
</dependency>
30+
<dependency>
31+
<groupId>org.springframework.cloud</groupId>
32+
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
33+
</dependency>
3634
<dependency>
3735
<groupId>org.springframework.boot</groupId>
3836
<artifactId>spring-boot-starter-actuator</artifactId>
3937
</dependency>
40-
<dependency>
41-
<groupId>org.springframework.cloud</groupId>
42-
<artifactId>spring-cloud-starter-openfeign</artifactId>
43-
</dependency>
38+
<dependency>
39+
<groupId>org.springframework.cloud</groupId>
40+
<artifactId>spring-cloud-starter-openfeign</artifactId>
41+
</dependency>
4442
<dependency>
4543
<groupId>org.springframework.boot</groupId>
4644
<artifactId>spring-boot-starter-test</artifactId>
4745
<scope>test</scope>
4846
</dependency>
49-
</dependencies>
50-
<dependencyManagement>
51-
<dependencies>
52-
<dependency>
53-
<groupId>org.springframework.cloud</groupId>
54-
<artifactId>spring-cloud-dependencies</artifactId>
55-
<version>${spring-cloud.version}</version>
56-
<type>pom</type>
57-
<scope>import</scope>
58-
</dependency>
59-
</dependencies>
60-
</dependencyManagement>
47+
</dependencies>
48+
<dependencyManagement>
49+
<dependencies>
50+
<dependency>
51+
<groupId>org.springframework.cloud</groupId>
52+
<artifactId>spring-cloud-dependencies</artifactId>
53+
<version>${spring-cloud.version}</version>
54+
<type>pom</type>
55+
<scope>import</scope>
56+
</dependency>
57+
</dependencies>
58+
</dependencyManagement>
6159

62-
<build>
63-
<plugins>
64-
<plugin>
65-
<groupId>org.springframework.boot</groupId>
66-
<artifactId>spring-boot-maven-plugin</artifactId>
67-
</plugin>
68-
</plugins>
69-
</build>
60+
<build>
61+
<plugins>
62+
<plugin>
63+
<groupId>org.springframework.boot</groupId>
64+
<artifactId>spring-boot-maven-plugin</artifactId>
65+
</plugin>
66+
<plugin>
67+
<groupId>org.apache.maven.plugins</groupId>
68+
<artifactId>maven-compiler-plugin</artifactId>
69+
</plugin>
70+
</plugins>
71+
</build>
7072

71-
</project>
73+
</project>
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,56 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4-
<modelVersion>4.0.0</modelVersion>
5-
<parent>
6-
<groupId>org.springframework.boot</groupId>
7-
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>3.4.4</version>
9-
<relativePath/> <!-- lookup parent from repository -->
10-
</parent>
11-
<groupId>com.learning</groupId>
12-
<artifactId>eurekaserver</artifactId>
13-
<version>0.0.1-SNAPSHOT</version>
14-
<name>eurekaserver</name>
15-
<description>eurekaserver</description>
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>org.springframework.boot</groupId>
7+
<artifactId>spring-boot-starter-parent</artifactId>
8+
<version>3.4.4</version>
9+
<relativePath/> </parent>
10+
<groupId>com.learning</groupId>
11+
<artifactId>eurekaserver</artifactId>
12+
<version>0.0.1-SNAPSHOT</version>
13+
<name>eurekaserver</name>
14+
<description>eurekaserver</description>
1615

17-
<properties>
18-
<java.version>21</java.version>
19-
<spring-cloud.version>2024.0.1</spring-cloud.version>
20-
</properties>
21-
<dependencies>
22-
<dependency>
23-
<groupId>org.springframework.cloud</groupId>
24-
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
25-
</dependency>
16+
<properties>
17+
<spring-cloud.version>2024.0.1</spring-cloud.version>
18+
</properties>
19+
<dependencies>
20+
<dependency>
21+
<groupId>org.springframework.cloud</groupId>
22+
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
23+
</dependency>
2624

27-
<dependency>
28-
<groupId>org.springframework.boot</groupId>
29-
<artifactId>spring-boot-starter-test</artifactId>
30-
<scope>test</scope>
31-
</dependency>
32-
</dependencies>
33-
<dependencyManagement>
34-
<dependencies>
35-
<dependency>
36-
<groupId>org.springframework.cloud</groupId>
37-
<artifactId>spring-cloud-dependencies</artifactId>
38-
<version>${spring-cloud.version}</version>
39-
<type>pom</type>
40-
<scope>import</scope>
41-
</dependency>
42-
</dependencies>
43-
</dependencyManagement>
25+
<dependency>
26+
<groupId>org.springframework.boot</groupId>
27+
<artifactId>spring-boot-starter-test</artifactId>
28+
<scope>test</scope>
29+
</dependency>
30+
</dependencies>
31+
<dependencyManagement>
32+
<dependencies>
33+
<dependency>
34+
<groupId>org.springframework.cloud</groupId>
35+
<artifactId>spring-cloud-dependencies</artifactId>
36+
<version>${spring-cloud.version}</version>
37+
<type>pom</type>
38+
<scope>import</scope>
39+
</dependency>
40+
</dependencies>
41+
</dependencyManagement>
4442

45-
<build>
46-
<plugins>
47-
<plugin>
48-
<groupId>org.springframework.boot</groupId>
49-
<artifactId>spring-boot-maven-plugin</artifactId>
50-
</plugin>
51-
</plugins>
52-
</build>
43+
<build>
44+
<plugins>
45+
<plugin>
46+
<groupId>org.springframework.boot</groupId>
47+
<artifactId>spring-boot-maven-plugin</artifactId>
48+
</plugin>
49+
<plugin>
50+
<groupId>org.apache.maven.plugins</groupId>
51+
<artifactId>maven-compiler-plugin</artifactId>
52+
</plugin>
53+
</plugins>
54+
</build>
5355

54-
</project>
56+
</project>
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,36 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4-
<modelVersion>4.0.0</modelVersion>
5-
<parent>
6-
<groupId>org.springframework.boot</groupId>
7-
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>3.4.4</version>
9-
<relativePath/> <!-- lookup parent from repository -->
10-
</parent>
11-
<groupId>com.learning</groupId>
12-
<artifactId>greetingservice</artifactId>
13-
<version>0.0.1-SNAPSHOT</version>
14-
<name>greetingservice</name>
15-
<description>greetingservice</description>
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>org.springframework.boot</groupId>
7+
<artifactId>spring-boot-starter-parent</artifactId>
8+
<version>3.4.4</version>
9+
<relativePath/> </parent>
10+
<groupId>com.learning</groupId>
11+
<artifactId>greetingservice</artifactId>
12+
<version>0.0.1-SNAPSHOT</version>
13+
<name>greetingservice</name>
14+
<description>greetingservice</description>
1615

17-
<properties>
18-
<java.version>21</java.version>
19-
<spring-cloud.version>2024.0.1</spring-cloud.version>
20-
</properties>
21-
<dependencies>
22-
<dependency>
23-
<groupId>org.springframework.boot</groupId>
24-
<artifactId>spring-boot-starter-web</artifactId>
25-
</dependency>
16+
<properties>
17+
<spring-cloud.version>2024.0.1</spring-cloud.version>
18+
</properties>
19+
<dependencies>
20+
<dependency>
21+
<groupId>org.springframework.boot</groupId>
22+
<artifactId>spring-boot-starter-web</artifactId>
23+
</dependency>
2624
<dependency>
2725
<groupId>org.projectlombok</groupId>
2826
<artifactId>lombok</artifactId>
2927
<version>1.18.38</version>
3028
<scope>provided</scope>
3129
</dependency>
3230
<dependency>
33-
<groupId>org.springframework.cloud</groupId>
34-
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
35-
</dependency>
31+
<groupId>org.springframework.cloud</groupId>
32+
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
33+
</dependency>
3634
<dependency>
3735
<groupId>org.springframework.boot</groupId>
3836
<artifactId>spring-boot-starter-test</artifactId>
@@ -42,31 +40,30 @@
4240
<groupId>org.springframework.boot</groupId>
4341
<artifactId>spring-boot-starter-actuator</artifactId>
4442
</dependency>
45-
<dependency>
46-
<groupId>org.springframework.boot</groupId>
47-
<artifactId>spring-boot-starter-test</artifactId>
48-
<scope>test</scope>
49-
</dependency>
50-
</dependencies>
51-
<dependencyManagement>
52-
<dependencies>
53-
<dependency>
54-
<groupId>org.springframework.cloud</groupId>
55-
<artifactId>spring-cloud-dependencies</artifactId>
56-
<version>${spring-cloud.version}</version>
57-
<type>pom</type>
58-
<scope>import</scope>
59-
</dependency>
60-
</dependencies>
61-
</dependencyManagement>
43+
</dependencies>
44+
<dependencyManagement>
45+
<dependencies>
46+
<dependency>
47+
<groupId>org.springframework.cloud</groupId>
48+
<artifactId>spring-cloud-dependencies</artifactId>
49+
<version>${spring-cloud.version}</version>
50+
<type>pom</type>
51+
<scope>import</scope>
52+
</dependency>
53+
</dependencies>
54+
</dependencyManagement>
6255

63-
<build>
64-
<plugins>
65-
<plugin>
66-
<groupId>org.springframework.boot</groupId>
67-
<artifactId>spring-boot-maven-plugin</artifactId>
68-
</plugin>
69-
</plugins>
70-
</build>
56+
<build>
57+
<plugins>
58+
<plugin>
59+
<groupId>org.springframework.boot</groupId>
60+
<artifactId>spring-boot-maven-plugin</artifactId>
61+
</plugin>
62+
<plugin>
63+
<groupId>org.apache.maven.plugins</groupId>
64+
<artifactId>maven-compiler-plugin</artifactId>
65+
</plugin>
66+
</plugins>
67+
</build>
7168

72-
</project>
69+
</project>

microservices-self-registration/greetingservice/src/main/java/com/learning/greetingservice/MyCustomHealthCheck.java

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
package com.learning.greetingservice;
22

3-
import lombok.extern.slf4j.Slf4j;
3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
45
import org.springframework.boot.actuate.health.Health;
56
import org.springframework.boot.actuate.health.HealthIndicator;
67
import org.springframework.scheduling.annotation.Scheduled;
78
import org.springframework.stereotype.Component;
89

910
@Component("myCustomHealthCheck")
10-
@Slf4j
1111
public class MyCustomHealthCheck implements HealthIndicator {
1212

13+
private static final Logger log = LoggerFactory.getLogger(MyCustomHealthCheck.class);
14+
1315
private volatile boolean isHealthy = true;
1416

1517
@Scheduled(fixedRate = 5000) // Run every 5 seconds
1618
public void updateHealthStatus() {
1719
// Perform checks here to determine the current health
1820
// For example, check database connectivity, external service availability, etc.
19-
boolean currentHealth = performHealthCheck();
20-
isHealthy = currentHealth;
21-
log.info("Updated health status : {}", isHealthy);
21+
isHealthy = performHealthCheck();
22+
log.info("Update health status : {}", isHealthy);
2223
}
2324

2425
private boolean performHealthCheck() {
25-
// Replace this with your actual health check logic
26-
// For demonstration, let's toggle the status every few runs
27-
boolean current = System.currentTimeMillis() % 10000 < 5000;
26+
boolean current = System.currentTimeMillis() % 10000 < 5000; // Simulate fluctuating health
2827
log.debug("Performing health check, current status: {}", current);
2928
return current; // Simulate fluctuating health
3029
}

0 commit comments

Comments
 (0)