File tree Expand file tree Collapse file tree 3 files changed +39
-1
lines changed
java/org/test/consumer/config Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Original file line number Diff line number Diff 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
2020dependencies {
2121 implementation ' org.springframework.boot:spring-boot-starter-activemq'
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 1+ # ActiveMQ Configuration
2+ spring.profiles.active =jms
13queuename =${EVENT_QUEUE_NAME:JMS-event-queue}
24brokerurl =${JMS_BROKER_URL:tcp://127.0.0.1:61616}
35brokerusername =${JMS_BROKER_USERNAME:}
You can’t perform that action at this time.
0 commit comments