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

## What is PicoContainer?

PicoContainer is a highly embeddable, full-service, Inversion of Control (IoC) container for components honor the Dependency Injection pattern. The project started in 2003 and pioneered Constructor Injection auto-wiring. It is also Open Source and therefore free to use. The license is BSD and thus you can safely use this with commercial or other open source software.

You could use it as a lightweight alternative to Sun's J2EE patterns for web applications or general solutions.

What is Dependency Injection? Martin Fowler has a good article from 2003, but here is another view: It is a good design pattern that, for large enterprise applications, facilitates:

- easy best practice unit testing vs little and difficult unit testing.
- component reuse vs rewriting through ignorance or perceived needs
- configuration given to componentsvs components reading their own scattered config
- clean & declarative architecture vs a nest of singletons that nobody can make sense of
- maintainability vs developers having difficulties fixing bugs
- adaptability vs developers not knowing where to start to add features
- transparency vs lots of framework code, with consequential lock in

Dependency Injection is quite often, but not exclusively, used by Agile practitioners. It counters situations where enterprise applications:

- have grown to be thousands of classes, with dozens if not hundreds of Singletons
- draw similarities to Spaghetti, Hairballs or Balls of Mud
- has made development staff looking after it miserable, and wanting to quit
- suffers repeated allegations of "it cannot be further developed without complete rewrite"

Despite it being very compact in size (the core is ~260K and it has no mandatory dependencies outside the JDK), PicoContainer supports different dependency injection types (Constructor, Setter, Annotated Field / Method) and offers multiple lifecycle and monitoring strategies.

If you're trying to understand the difference between PicoContainer and similar libraries, then its best to think of PicoContainer as a map that where add() is for types and implementations, and get() is for instances.

PicoContainer has originally been implemented in Java but is also available for other platforms and languages. These are detailed here.

### Read More?

The Introduction page discusses basic PicoContainer usage, and has pictures - yay!