winter / io.jentz.winter / BoundService / onPostConstruct

onPostConstruct

abstract fun onPostConstruct(instance: R): Unit

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

For example:

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

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