Petite is one great little IoC container and components manager. Petite is easy to use since it requires no external configuration; it is incredibly fast, lightweight and super-small; so anyone can quickly grasp how it works. Petite is quite extensible and open for customization; and non-invasive.
Quick Overview
The following bean shows some basic Petite usage:
@PetiteBeanpublicclassFoo{ // dependency injected in the ctor@PetiteInjectpublicFoo(ServiceOneone){...} // dependency injected in a field@PetiteInject("serviceTwo")ServiceTwo two; // dependency injected with the method@PetiteInjectpublicvoidinjectService(ServiceThreethree){...} // dependency injected with the methodpublicvoidinjectService(@PetiteInjectServiceFourfour){...} // initialization method@PetiteInitMethodpublicvoidinit(){...}publicvoidfoo(){}}
Foo is Petite bean that defines several injection points, for different depending services from the container. Put this bean in the classpath and let PetiteContainer find it and register as a bean. Or register it manually if you like that way more.
Why should I use it?
Petite is one of the lightest Java DI container around. Still, it supports sufficient most of features offered by other containers.
Here are the key features:
property, method and constructor injection points.