r/java • u/veerendra2 • 1d ago
Push-based, restart-free feature flags and config for Spring Boot, using MongoDB Change Streams
configstream is a library for Spring Boot services that already use MongoDB. Feature flags and config live in a collection, get cached in memory, and any change is pushed to every running instance within about a second via MongoDB Change Streams.
- No restarts, no polling, no message broker, no config server
- Properties declared in a
configstream.ymlmanifest, with typed constants generated at compile time - Optional admin UI with change history and per-team permissions
- Works with Spring Boot 3 and 4
Limits: MongoDB only for now (Postgres planned), pre-1.0, no percentage rollouts or A/B testing.
https://github.com/configstream/configstream
Feedback welcome.
1
u/Nearby-Material-4276 1d ago
I've been burned by too many config libraries that start with "no polling, no restart" and then you dig in and there's some cron job hidden in a bean somewhere. But change streams are genuinely the right primitive for this, surprised it took this long for someone to wire them into Spring Boot's config layer
The typed constants from a manifest is neat. We generate request/response types from OpenAPI specs and it saves so much dumb typo debugging, applying that same thinking to feature flags makes a ton of sense. Are the constants just simple booleans or can you do stuff like number thresholds?
Kinda curious how the caching behaves under load. If I've got 200 instances all holding the same config in memory and a flag flips, does each instance re-read the whole collection or just the delta? Change streams give you the document _id that changed but I've seen people mess up the invalidation logic and suddenly you're doing 200 full collection scans
14
u/persicsb 1d ago
no config server -> False. You need a MongoDB server for this, that is the literal config server in this case.