onPostConstruct
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() }
}Content copied to clipboard
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.
Parameters
graph
The graph that was passed to newInstance.
instance
The instance that was returned from newInstance.