IoC - Inversion of Control.

"Context IOC on the other hand is Inversion of Control at its purest - just a pattern for design without any baggage."

This excellent article by Sony Mathew explains the advantages of using contextual Inversion of Control rather than the injected Inversion of Control that many frameworks provide java developers.

The Commons-IoC project is a light-weight, framework independant, addition to the Contextual Inversion of Control pattern.

The contextual approach is where classes with dependency requirements define a "Context" interface and using plain old java code inject it manually via the constructor or setter method as needed.

The primary benefit of using this library over other IoC libraries is that it is incredibly light-weight, and completely framework independant, unlike implementations from Spring, Plexus, and JBoss.

A secondary benefit is its simplity. With only two public classes and only one public method in total it is a straight forward API to use.

Commons-IoC provides a base context marker interface "BaseContext". By having Context extend it projects with a deep IoC rather than a broad but shallow chain, where common dependencies are defined and used at each level the utility class ContextWrapper allows context implementations to be 'wrapped' into the next context implementation. This provides an ordered Proxy stack on contexts where the first matching method signature is used for any method invocation. Reflection results are cached per proxy instance to improve performance(~10%).

Because compile-time safety is lost against this proxy stack, by enabling assertions it is possible to check that all methods that the top-level Proxy is intended to implement are infact found somewhere down the stack on the first invocation call on the Proxy.

Read apidocs/ for more.