-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Hey Scott, this is something that I could have done a better job of explaining...
So one thing that Spring is really good at is setter injection. Essentially, if you create setters in your Mario class for the PrintWriter and the ScreenWriter and you add a corresponding property tag in the Mario bean; Spring will inject your classes automatically.
so instead of having to say context.getBean(.....
we could just assume that the PyramidPrintWriter is already populated when the program starts up.
something like....
will be automatically injected into
public void setPyramidFilePrinter(PyramidFilePrinter pyramidFilePrinter) {
this.pyramidFilePrinter = pyramidFilePrinter;
}
public void setPyramidScreenPrinter(PyramidScreenPrinter pyramidScreenPrinter) {
this.pyramidScreenPrinter = pyramidScreenPrinter;
}
Cheers,
Mike