Module io.jstach.rainbowgum.scopedkeyvalues.provider


module io.jstach.rainbowgum.scopedkeyvalues.provider
EXPERIMENTAL The RainbowGum-backed io.jstach.rainbowgum.scopedkeyvalues.spi.ScopedKeyValuesProvider for io.jstach.rainbowgum.scopedkeyvalues.ScopedKeyValues - request/task-scoped key values backed by java.lang.ScopedValue instead of ThreadLocal. Simply being on the classpath is enough: this module's ScopedKeyValuesConfigurator registers a LogEventFactory.KeyValuesContributor, so every event from any logging API (SLF4J, JUL, System.Logger, ...) carries the current scoped key values. SLF4J's MDC wins over scoped key values on a key collision.

Requires a JVM supporting java.lang.ScopedValue (finalized in JDK 25, JEP 506) - newer than this project's usual baseline, which is why this module alone overrides its own build's Java release. The io.jstach.rainbowgum.scopedkeyvalues API module this implements does not share that requirement.

  • Packages

    Exports
    Package
    Description
    The RainbowGum-backed ScopedKeyValuesProvider, using java.lang.ScopedValue for storage, plus the RainbowGumServiceProvider that registers it as a key values contributor for every logging API.
  • Services

    Provides
    Type
    Description
    RainbowGum SPI.
    Service Provider Interface ServiceLoader actually discovers for ScopedKeyValues - a factory rather than the ScopedKeyValuesProvider itself, since a factory method can do things a bare no-arg-constructor ServiceLoader instantiation cannot (validate preconditions, choose between alternate implementations, read configuration, etc) without ScopedKeyValues needing to know anything about how the provider it gets back was actually put together.