Changelog

All notable changes to kotlin-container.

0.4.02026-03-29

Added

  • Thread-safe concurrent resolution: singletons created exactly once, scoped instances once per scope, per-thread circular dependency detection
  • Convenience extensions: resolveOrNull, has, lazy on Resolver
  • Container { } DSL builder for setup-in-one-shot
  • scope(vararg providers) { } extension for scopes with pre-registered providers
  • Concurrency test suite

Changed

  • Internal collections replaced with ConcurrentHashMap, ThreadLocal, @Volatile, and synchronized double-checked locking

DSL Builder — Container { }

kotlin
// Before (0.3.1)
val container = Container()
container.singleton<Logger> { ConsoleLogger() }
container.factory<PaymentGateway> { StripeGateway() }

// Now (0.4.0)
val container = Container {
    singleton<Logger> { ConsoleLogger() }
    factory<PaymentGateway> { StripeGateway() }
}

Scope block — scope { }

kotlin
// Before (0.3.1)
val scope = container.child()
scope.scoped<DbConnection> { DbConnection() }
val db = scope.resolve<DbConnection>()
// ... use db
scope.close()

// Now (0.4.0)
container.scope { scope ->
    val db = scope.resolve<DbConnection>()
    // ... use db
}  // auto-closes

Scope with providers — scope(providers) { }

kotlin
// Before (0.3.1)
val scope = container.child()
scope.register(RequestScopeProvider(request))
scope.register(LoggingProvider())
scope.resolve<RequestHandler>().handle()
scope.close()

// Now (0.4.0)
container.scope(RequestScopeProvider(request), LoggingProvider()) { scope ->
    scope.resolve<RequestHandler>().handle()
}  // auto-closes, providers pre-registered

0.3.12026-03-29

Added

  • Circular dependency detection with clear error messages and resolution chain reporting
  • Deep auto-resolution tests

Changed

  • Improved parameter resolution handling
  • Enforced single-assignment constraint on scoped onClose hooks

0.3.02026-03-28

Added

  • Parameterless registration overloads: singleton<T>(), factory<T>(), scoped<T>() for auto-resolved constructors
  • Convention-based service providers with auto-resolved register() parameters

0.2.02026-03-28

Added

  • Scoped bindings with lifecycle management (scoped, onClose, AutoCloseable support)
  • Nested scopes with cascading close
  • scope { } block-based syntax for automatic cleanup
  • Scope interface extending Container and AutoCloseable
  • Published to Maven Central via Vanniktech plugin

0.1.02026-03-28

Added

  • Core container with factory and singleton bindings
  • Auto-resolution of concrete classes via Kotlin reflection
  • Service providers with register() convention
  • Callable injection via call()
  • AutoResolver pluggable strategy
  • Interface segregation: Registrar, Resolver, Caller, Container