Closed GTarkin closed 6 years ago
@Inject
is used as a marker to indicate fields whose type should be scanned for Airline related annotations.
There is a 3x
branch that has Google Guice support submitted from PR #77 that is currently available as 3.0.0-alpha-1-SNAPSHOT
if you want to try that instead.
Longer term it may be worth replacing the @Inject
annotation with an Airline specific annotation
Hi,
I use Google-Guice as DI-Framework and integrate its mechanism by adding a custom made CommandFactory based on Google-Guice to the parser.
Snippet:
CliBuilder builder = Cli.builder("build");
builder.withGroup("a").withCommand(ACommand.class);
builder.withGroup("b").withCommand(BCommand.class);
builder.withGroup("c").withCommand(CCommand.class);
builder.withCommand(HelpWrapper.class) .withDefaultCommand(HelpWrapper.class);
builder.withParser().withCommandFactory(commandFactory);
HelpWrapper extends the default Help class, as the command interface I want to use has a signature different from "Runnable". There is a field annoted with @Inject in the Help class which confuses Guice as it can't find a DI-Binding for it (and shouldnt as it is filled by the parser as far as i can see). Why use @Inject in this place?