Skip to content
This repository was archived by the owner on Nov 3, 2022. It is now read-only.

Commit 88875fe

Browse files
committed
Add a startup message.
1 parent b5ffda6 commit 88875fe

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/main/java/uk/co/drnaylor/quickstart/Metadata.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,21 @@
44
*/
55
package uk.co.drnaylor.quickstart;
66

7+
import java.util.Optional;
8+
79
public class Metadata {
810

9-
public static String NAME = "@name@";
10-
public static String VERSION = "@version@";
11+
public final static String NAME = "@name@";
12+
public final static String VERSION = "@version@";
13+
14+
private static boolean hasStarted = false;
15+
16+
public static Optional<String> getStartupMessage() {
17+
if (!hasStarted) {
18+
hasStarted = true;
19+
return Optional.of("Starting " + NAME + " version " + VERSION + " subsystem.");
20+
}
21+
22+
return Optional.empty();
23+
}
1124
}

src/main/java/uk/co/drnaylor/quickstart/ModuleContainer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ public ModuleContainer build() throws QuickStartModuleDiscoveryException {
384384
classLoader = getClass().getClassLoader();
385385
}
386386

387+
Metadata.getStartupMessage().ifPresent(x -> Logger.getLogger("QuickStart").info(x));
387388
return new ModuleContainer(configurationLoader, classLoader, packageToScan, constructor);
388389
}
389390
}

0 commit comments

Comments
 (0)