
Petite is a IoC container. (oh-no-yet-another-one). Then again, it is easy to use since it requires no external configuration; it is incredibly fast; it is lightweight and small so anyone can understand how it works just from examining the code; it is extensible and open for customization; and, finally, it is non-invasive.
The following bean shows basic Petite usage:
@PetiteBean
public class Foo {
@PetiteInject
public Foo(ServiceOne one) {...}
@PetiteInject("serviceTwo")
Service two;
@PetiteInject
public void injectService3(ServiceThree three) {...}
@PetiteInitMethod
public void init() {...}
public void foo() {
}
}
Foo is Petite bean that defines several injection points, for different services from the container.
Above example uses only defaults; however, it can be configured in many ways.
Petite is one of the lightest Java DI container around. Still, it supports sufficient most of features offered by other containers. To some it may resemble to Guice (due to annotations usage): and yes it does, but Petite was developed first and it still has some conceptual differences.
Here are the key features: