View/Hide Sitemap Inline ...

Multiple Injection


This is where a component has is a blend of one or more of Constructor, Setter, Method, Annotated Field etc:

public class Apple {
  private Orange orange;
  private Pear pear; @Inject private Banana banana;
  public inject(Orange orange) { = orange;
  public void inject(Pear pear) {
    this.pear = pear; 
  // other methods 


pico = new DefaultPicoContainer(new MultiInjection();
pico.addComponent(Apple.class); // etc 
Apple apple = pico.getComponent(Apple.class);

In the case above, Orange comes in through the constructor, Pear by method injection and Banana is via Annotated Field Injection.

The component factory for this is MultiInjection .