Skip to main content
PreparationZone Logo
PreparationZone
Back to Java

Java · Medium · Pro

Composition root — where to wire dependencies in plain Java?

JavaDesign PatternsStaff
Model answerPreview

Composition root

The composition root is the single place in the application where object graphs are wired: constructors called, interfaces bound to implementations, lifetimes chosen. Everything inward depends on abstractions; only the root knows concrete types.

  • In plain Java: main, a Application…