PetiteContainer
provides the single method for registering beans: registerPetiteBean()
that takes following arguments:type
- beans type, must be specified.name
- beans name. If null
the name will be resolved from the class.scopeType
- bean scope. If null
the 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.type
and name
(and provide null
s to all others).registerPetiteBean()
you may use PetiteRegistry
class that offers nice, fluent interface for easier registration.foo.foo()
yet! By default PetiteContaienr
needs annotations to resolve dependencies.@PetiteInitMethod
. Example:@PetiteInitMethod
element 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: -1
and -3
, the first will be invoked the method marked with order -3
. Method marked with -1
will 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 injectionPOST_INITALIZED
- invoked after bean has been completely initialized, after the parameters injection. This is the default strategy.AutomagicPetiteConfigurator
: it will scan the classpath for all classes annotated with @PetiteBean
annotation and automatically register them. Class scanning of @PetiteBean
is 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:@PetiteBean
annotation 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.@PetiteBean
is a simple Petite bean marker that contains just few elements:value
- defines bean's name; by default bean name equals toscope
- bean's scope, by default it is DefaultScope
.wiring
- wiring mode (explained next).@PetiteBean
annotation is used for automatic registration, it will be also considered during manual registration!BeanUtil
, except it is applied on Petite context:BeanUtil
is that first part of the property path (pojo
) is actually the name of a registered bean.