winter / io.jentz.winter / BoundService / postConstruct

postConstruct

abstract fun postConstruct(argument: A, instance: R): Unit

This is called after a new instance was created but not until the complete dependency request is completed.

For example:

graph {
  singleton { Parent(child = instance()) }
  singleton { Child() }
}

When Parent is requested, Child has to be created but the postConstruct method of the Child service is called after Parent is initialized. This way we can resolve cyclic dependencies in post-construct callbacks.