10969b185d
InitStep instances are created before a site is initialized and the set of injectable objects is quite small at that time. This also limits what could be done from the postRun method, which is invoked after site is initialized. After the site is initialized a sysInjector is already available and we could make use of it in order to perform optional injection and provide the InitStep.postRun with additional useful objects. This way the postRun can perform many more things than before. To make use of the optional injection in an InitStep one would write something like: public class MyInitStep implements InitStep { private final ConsoleUI ui; @Inject MyInitStep(ConsoleUI ui) { this.ui = ui; } @Override public void run() throws Exception { ... } @Inject(optional = true) void setGitRepositoryManager(GitRepositoryManager git) { gitManager = git; } @Override public void postRun() throws Exception { // make use of gitManager } } Change-Id: Idfd04747f45db8c7e0aee892175245ccd280d5e0 |
||
---|---|---|
.. | ||
src | ||
BUCK |