I've been trying to answer this same question. I think I've gotten close to how it "should" work ideally, but I'm just derping around the GitHub project and trying to figure it out based upon scraps of information there, as a lot of the documentation for Dagger 2 is still being written (as of this week).
My example code below is actually for an Android Activity, but I believe this same approach should work for the servlet you're asking about.
Add a MembersInjector<...> to your @Component interface; for example, in the below component I've added one for my MainActivity class:
package ...;
import javax.inject.Singleton;
import dagger.Component;
import dagger.MembersInjector;
@Singleton
@Component(modules = { PlaygroundModule.class })
public interface MainComponent {
Wizard createWizard();
MembersInjector<MainActivity> mainActivityInjector();
}
And then in your class that you want to be member-injected, at an appropriate place after object creation but before you need to use your injected members, you need to create the component and use the member injection:
package ...;
// other imports
import javax.inject.Inject;
import dagger.MembersInjector;
public class MainActivity extends ActionBarActivity {
@Inject
Wizard wizard;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MainComponent c = DaggerMainComponent.create();
c.mainActivityInjector().injectMembers(this);
// other code...
}
}
The one thing I'm not clear on is whether this pattern of creating the component inside the object that's supposed to be injected into is correct. It doesn't quite feel right, but, it's still very flexible since you're only binding tightly to the component and not the modules. So perhaps this is the correct approach, but perhaps it's a bit off.