Config Source Types

MARZ supports four config source schemes. Each @Marz field can specify its source via the source parameter.

File Source (file://)

Watches a local file for changes using OS-level WatchService (inotify on Linux, kqueue on macOS). Supports YAML, JSON, and .properties formats.

@Marz(key = "feature.enabled", source = "file://config/features.yml")
private volatile boolean enabled = false;

Classpath Source (classpath:)

Reads from the classpath. If the file is on the filesystem (not inside a JAR), WatchService monitors it. If inside a JAR, read-once at startup.

@Marz(key = "app.name", source = "classpath:defaults.yml")
private volatile String appName = "MyApp";

HTTP Source (http:// / https://)

Polls a remote HTTP endpoint. Uses ETag conditional GET to minimize bandwidth. Exponential backoff on failures.

@Marz(key = "feature.enabled", source = "https://config.internal/api/flags")
private volatile boolean enabled = false;

Platform Source (platform://marz)

Connects to the MARZ Platform via WebSocket. Requires marz.platform.api-key in application.yml. Changes from the dashboard are applied in <1ms via the hot path. The MARZ Platform is coming soon.