Skip to content

Commit 0fde84f

Browse files
authored
Merge pull request #103 from avaje/feature/test-native-image-profiles
test for native image using avaje.profiles (via system property)
2 parents c68ff34 + 2c6d548 commit 0fde84f

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

.github/workflows/native-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ jobs:
3636
mvn clean install -DskipTests
3737
cd tests/test-native-image
3838
mvn clean package -Pnative
39-
./target/test-native
39+
./target/test-native -Davaje.profiles=admin
Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
{
22
"resources": [
33
{
4-
"pattern": "application.properties"
4+
"pattern": "application.*properties"
55
},
66
{
7-
"pattern": "application.yaml"
7+
"pattern": "application.*yaml"
88
},
99
{
10-
"pattern": "application.yml"
11-
},
12-
{
13-
"pattern": "application-*.properties"
14-
},
15-
{
16-
"pattern": "application-*.yaml"
17-
},
18-
{
19-
"pattern": "application-*.yml"
10+
"pattern": "application.*yml"
2011
}
2112
]
2213
}

tests/test-native-image/src/main/java/org/example/Main.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
public class Main {
66

77
public static void main(String[] args) {
8-
String val = Config.get("hello.world", "not-set");
9-
System.out.println("Hello - " + val);
8+
// System.getProperties().list(System.out);
9+
// System.out.println("---");
10+
String profiles = System.getProperty("avaje.profiles");
11+
System.out.println("avaje.profiles=" + profiles);
12+
System.out.println("hello.world - " + Config.get("hello.world", "not-set"));
13+
System.out.println("admin - " + Config.get("admin", "not-set"));
14+
System.out.println("common - " + Config.get("common", "not-set"));
1015
}
1116
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
common=From-application-admin.properties
2+
admin=InAdmin
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
hello.world=Rob
2+
common=From-application.properties

0 commit comments

Comments
 (0)