Pico Container

# About

- What is PicoContainer?
- Introduction
- Javadoc
- Downloads
- News
- FAQ
- Project Goals
- Support

# Core Concepts

- Component Lifecycle
- Dependency Injection
- Scoped Containers

# Dependency Injection

- Constructor Injection
- Setter Injection
- Annotated Field Injection
- Annotated Method Injection
- Typed Field Injection
- Named Field Injection
- Method Injection
- Multiple Injection
- Composite Injection
- Factory Injection
- Reinjection
- Injection via Providers

# Configuration

- Disambiguation

# Modifying Component Behaviors

- Modifying Behaviors
- Caching and Singletons
- Hiding Implementations
- Thread Safety Behaviors
- AOP Style Interception

# Advanced Concepts

- Fluent Style
- Arrays, Collections and Maps
- Leveraging Parameter Names
- Building Containers
- Component Properties
- Component Configuration
- Monitoring Component Events

# PicoContainer's Architecture

- Design Patterns
- Inversion of Control
- Component Adapters
- Mock Objects
- Terminology
- Container Comparisons
- Transparency

# Container Choices

- DefaultPicoContainer
- CommandLinePicoContainer
- PropertiesPicoContainer
- SystemPropertiesPicoContainer
- TransientPicoContainer
- TieringPicoContainer

# Dependant & Related

- Web Frameworks
- Scripting Support
- Persistence
- Logging

# Anti-patterns

- Propagating Dependency
- Long Constructor Argument List
- Container Dependency
- Unit Tests Use Container
- Singleton

# Help Pages

- Ambiguous Injectable
- Unprocessed Properties

# History

- Inversion of Control History

# Project Info

- Project
- Team

# Hosted by

# Tools

## Method Injection

### Overview

This is where a component has an empty constructor and gets all its dependencies injected into single method after instantiation:

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

### Usage

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

Custom injection method prefix:

    pico = new DefaultPicoContainer(new MethodInjection("mySynonymForInject");
    pico.addComponent(Apple.class);
    // etc
    Apple apple = pico.getComponent(Apple.class);

Via the default AdaptiveInjection Method injection, via a characteristic:

    pico = new DefaultPicoContainer();
    pico.as(Characteristics.METHOD_INJECTION).addComponent(Apple.class);
    // etc
    Apple apple = pico.getComponent(Apple.class);

The method name needs be 'inject' unless overridden in the InjectionFactory.

The component factory for this is MethodInjection. It only handles method-injection types of components.

Additionally the default component factory AdaptiveInjection can also handle method-injection types, but only if the METHOD_INJECTION characteristic is specified.