PetiteContainerprovides the single method for registering beans:
registerPetiteBean()that takes following arguments:
type- beans type, must be specified.
name- beans name. If
nullthe name will be resolved from the class.
scopeType- bean scope. If
nullthe scope will be resolved from the class.
wiringMode- defines wiring mode. Also may be omitted.
define- if set to
true, injection points will be resolved.
nulls to all others).
registerPetiteBean()you may use
PetiteRegistryclass that offers nice, fluent interface for easier registration.
foo.foo()yet! By default
PetiteContaienrneeds annotations to resolve dependencies.
order. Order is a simple integer number. If order value is negative, those methods will be invoked last, starting from lesser number. For example, if methods are ordered as:
-3, the first will be invoked the method marked with order
-3. Method marked with
-1will be executed last. If order is not used, method will be invoked after the first ones (marked with positive order number) and the last ones (marked with negative order).
POST_CONSTRUCT- invoked just after a bean is created, before wiring and parameters injection.
POST_DEFINED- invoked after bean has been wired with other beans, but before parameters injection
AutomagicPetiteConfigurator: it will scan the classpath for all classes annotated with
@PetiteBeanannotation and automatically register them. Class scanning of
@PetiteBeanis quite fast: only the byte content is examined, so no other class is loaded during this process then the marked ones. It is possible to narrow the searched class path and fine-tune the scanning. Example:
@PetiteBeanannotation is also considered during manual bean registration, so marked beans may be also manually registered just by class reference, other properties will be read from the annotation's elements.
@PetiteBeanis a simple Petite bean marker that contains just few elements:
value- defines bean's name; by default bean name equals to
scope- bean's scope, by default it is
wiring- wiring mode (explained next).
@PetiteBeanannotation is used for automatic registration, it will be also considered during manual registration!
BeanUtil, except it is applied on Petite context:
BeanUtilis that first part of the property path (
pojo) is actually the name of a registered bean.