Skip to content

Commit e4e1472

Browse files
committed
Update version + profile check
1 parent edd93e5 commit e4e1472

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repositories {
1515
}
1616
}
1717

18-
ext.fineractVersion = '0.0.1129-2c0625f'
18+
ext.fineractVersion = '0.0.1158-d0988ae'
1919

2020
dependencies {
2121
implementation 'org.springframework.boot:spring-boot-starter-activemq'
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.test.consumer.config;
2+
3+
import jakarta.annotation.PostConstruct;
4+
import org.springframework.beans.factory.annotation.Value;
5+
import org.springframework.context.annotation.Configuration;
6+
import org.springframework.core.env.Environment;
7+
8+
@Configuration
9+
public class ProfileConfig {
10+
11+
private final Environment environment;
12+
13+
public ProfileConfig(Environment environment) {
14+
this.environment = environment;
15+
}
16+
17+
@PostConstruct
18+
public void validateActiveProfile() {
19+
String[] activeProfiles = environment.getActiveProfiles();
20+
21+
if (activeProfiles.length == 0) {
22+
throw new IllegalStateException("No active profile set. Please set either 'jms' or 'kafka' as active profile. " +
23+
"You can set it in application.properties with 'spring.profiles.active=jms' or 'spring.profiles.active=kafka' " +
24+
"or using environment variable 'SPRING_PROFILES_ACTIVE'.");
25+
}
26+
27+
for (String profile : activeProfiles) {
28+
if ("jms".equals(profile) || "kafka".equals(profile)) {
29+
return;
30+
}
31+
}
32+
33+
throw new IllegalStateException("Invalid active profile. Please use either 'jms' or 'kafka' profile. " +
34+
"Current active profiles: " + String.join(", ", activeProfiles));
35+
}
36+
}

src/main/resources/application.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# ActiveMQ Configuration
2+
spring.profiles.active=jms
13
queuename=${EVENT_QUEUE_NAME:JMS-event-queue}
24
brokerurl=${JMS_BROKER_URL:tcp://127.0.0.1:61616}
35
brokerusername=${JMS_BROKER_USERNAME:}

0 commit comments

Comments
 (0)