Playground repository for experimenting with multi-module Maven setup and the ServiceLoader class in Java.
A proof-of-concept project that uses Java's ServiceLoader to dynamically discover and register plugin implementations at runtime — no hardcoded references required. Application entry point is ApplicationLauncher.java.
Plugins are grouped into families, each representing a type of capability (e.g. a weather plugin family). A family can have multiple variants, each configured independently to target different endpoints, retry limits, etc. At startup, variant configuration files are read from disk, merged with per-family defaults, and used to initialise each plugin instance.
- JDK 23 — install from the official site or via Homebrew:
brew install openjdk@23 - Maven 3 — install from the official site or via Homebrew:
brew install maven
This project includes version files for jenv (.java-version) and mvnvm (mvnvm.properties). Both can be installed via Homebrew:
brew install jenv mvnvmjenv requires additional shell configuration, after which the installed JDK can be registered with:
jenv add /opt/homebrew/opt/openjdk@23The application reads plugin configuration files from a root directory. The path is resolved in order of precedence:
- JVM system property —
-DCONFIGURATION_ROOT_PATH=<path> - Environment variable —
CONFIGURATION_ROOT_PATH=<path> - Default —
~/config
The path must point to an existing directory. Each plugin implementation (family) has its own subdirectory containing a defaults.json (shared base values) file and one or more variant files that are merged on top of the default plugin configuration values when read in. An example of such can be found in the Extension A defaults.
From the project root:
mvn packageThis produces a thin jar for the launcher along with all dependency jars in launcher/target/lib/.
java -DCONFIGURATION_ROOT_PATH="$(pwd)/config" -jar launcher/target/launcher-1.0-SNAPSHOT.jarThe launch configuration sets CONFIGURATION_ROOT_PATH to the workspace config/ directory. Open the Run and Debug panel (⇧⌘D), select Java Application, and press F5.