The "Hen-and-Egg" Problem Solved.
To run, your program needs data. But how does it know where that data lives? mConfig bridges the gap. It performs lookups exactly where Operating Systems and users expect them to be, providing a unified, type-safe API that spans from embedded I2C storage to cloud-native orchestration.
- Universal Reach: A single library for the entire compute spectrum; from resource-constrained embedded systems to cloud-native microservices.
- Zero-Dependency Core: Keep your footprint small. The core is lightweight, modular, and dependency-free.
- Deep Origin Traceability: No more "ghost" settings. Every configuration value can be traced back to its specific source and layer.
- Enterprise-Ready Policy Enforcement: Includes a native POLICY scope to respect Windows Group Policy (GPO) and mandatory administrative overrides.
- the mConfig Windows module is Registry-Aware, automatically mapping Windows Group Policy (GPO) to the high-priority POLICY scope.
- Self-Healing & Late-Binding: Built-in file watcher detects changes and handles "late-bound" configurations (e.g., Kubernetes ConfigMaps mounted after startup).
- OS-Native Intelligence: Respects XDG Base Directory standards on Linux and Registry/ProgramData conventions on Windows.
- Modular Drop-in Support: mConfig implements Modular Directory Discovery, automatically layering .d fragments into the configuration stack without manual setup.
- Multi-Format Support: comes with format modules for TOML, YAML, JSON5, JSON, INI, and Java Properties.ΒΉ
- Type-Safe Config Schemes: Define your schema once. Includes validation, range-checking, and centralized defaults.
- Sensible Defaults, Total Control: Adheres to the "principle of least surprise" with its defaults. Every aspect is tunable via ConfigFeature flags for enterprise-level customization.
- Dynamic Updates: do not buffer values locally. Changes are immediately reflected in mConfig objects, so you always have the latest configuration available. ("zero-code data binding")
- Minimal Footprint: The core library is about 200kB (JAR size). This is exceptionally small compared to frameworks like Spring Boot or Apache Commons, making it ideal for microservices, serverless functions, and environments where memory/disk space is critical.
- CLI Tool: mConfig comes with a command-line tool for scripting, auditing, and troubleshooting.
- Test Mode: for CI/CD and local development, test mode provides a clean environment separate from deployment paths.
ΒΉ parsing of TOML,YAML,JSON5,JSON can be done using mature external libraries, so using these formats will increase your application's footprint. For TOML, INI, and Java Properties formats, mConfig provides native modules, which are smaller and preserve comments.
Choose the entry point that fits your project architecture:
Best for: Lightweight Java projects requiring standard filesystem support.
Maven:
<dependency>
<groupId>org.metabit.platform.support.config</groupId>
<artifactId>mconfigbasic</artifactId>
<version>${mconfig.version}</version>
<type>pom</type>
</dependency>Gradle:
implementation 'org.metabit.platform.support.config:mconfigbasic:${mconfig.version}'Best for: Enterprise environments requiring signed artifacts or a single "fat" JAR. Fully compatible with the Java Module System (JPMS) since v0.7.26.
Maven:
<dependency>
<groupId>org.metabit.platform.support.config</groupId>
<artifactId>mconfigbasicbinary</artifactId>
<version>${mconfig.version}</version>
</dependency>Gradle:
implementation 'org.metabit.platform.support.config:mconfigbasicbinary:${mconfig.version}'Best for: Modern cloud applications. Includes Environment Variables, Windows Registry, Slf4j, and full JSON/YAML support via Jackson.
Maven:
<dependency>
<groupId>org.metabit.platform.support.config</groupId>
<artifactId>mconfigstandard</artifactId>
<version>${mconfig.version}</version>
<type>pom</type>
</dependency>Gradle:
implementation 'org.metabit.platform.support.config:mconfigstandard:${mconfig.version}'- getting started - usage
- the documentation - read from the start
- notes for code-generating tools
- Jump to design documentation
Modern systems are complex, and maintenance can be a PITA.
The mconfig tool provides instant auditability, allowing you to troubleshoot, monitor, and update your application's environment without writing a single line of code or restarting your service.
# Diagnose a value's origin
mconfig mycompany:myapp:database get port -v
# List all discovered configs
mconfig mycompany:myapp list
# Show the full combined config contents
mconfig mycompany:myapp:database show
# Show the combined config contents as JSON
mconfig mycompany:myapp:database show --format json
# set a value
mconfig mycompany:myapp:database set port=3306
# set a value, create file if none existed yet.
mconfig mycompany:myapp:database set frequency=0.5s --create
# Monitor for changes (live-tail)
mconfig mycompany:myapp:network monitor --dumpPro Tip: Install via .deb package: mvn -pl mConfigTools package && sudo dpkg -i mConfigTools/target/*.deb
Zero-config boilerplates for Maven, Gradle, JPMS. Copy β Run β No errors!
Copy-paste fixes for everyday config problems: hardcodes, env vars, hot-reload, secrets, JPMS, tests.
In mConfig, defaults are a first-class citizen of the Config Scheme.
Unlike java.util.Properties, where you provide a default at every get() call, mConfig lets you define the name, type, restrictions, and default value in one central schema.
Result: Your business logic remains clean.
myStringValue = config.getString("db.timeout")
The library automatically handles type coercion, validation, and default fallbacks based on your predefined scheme.
Preventing "Log Leaks": By having a dedicated Secret type, mConfig can automatically mask these values (e.g., ********) in debug logs or administrative UIs, even if a developer accidentally calls toString() on the config object. Late Decryption: Keeping the value encrypted in memory until the exact moment it is needed (JIT Decryption) reduces the window of opportunity for "heap dump" attacks.
Configuration files often contain the "keys to the kingdom." mConfig doesn't just read data; it protects it.
Unlike standard libraries that treat passwords as plain strings, mConfig introduces a first-class Secret type.
- Automatic Masking: Secrets are protected from accidental exposure in logs, traces, and "ghost" file dumps.
- Schema-Enforced Security: Security is defined at the Scheme level. If a key is marked as a Secret, mConfig ensures it is handled with elevated safety protocols throughout its lifecycle.
For environments requiring high-grade encryption, mConfig integrates with the Java Cryptography Extension (JCE).
as of version 0.8, the following features are planned for the next major release:
- keeping secrets encrypted in memory until they are needed:
- Plug-and-Play Providers: Easily use BouncyCastle for FIPS-compliant or Post-Quantum cryptographic algorithms.
- Hardware Security: Support for hardware-backed keys and certificate-based configuration decryption.
- Standardized Formats: Natively handle PEM, PKCS#12, and other cryptographic containers as configuration sources.
see the documentation module, and the examples!
| Type | Status |
|---|---|
| Build (CI) | |
| Artifact | |
| Javadoc |