Hi,
I just wrote this wiki page on how to do dependency injection in a plugin:
I want to use this so that I can provide a move requests to external resource to a service class and pass a mock to my Publisher during unit tests.
The problem with the example I gave in the wiki is that I cannot provide a mock easily:
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener)
{
Guice.createInjector(new MyModule()).injectMembers(this);
// ...
mySvc.myServiceMethod(); // "it works!"
}
I need to remove that Guice.creatInjector() line.