It is possible to define container parameters that will be injected into its beans after the wiring and before the init method invocation. Parameter is defined with the String name and value of any type.
By default, parameters are injected before init method invocation. In some cases, some init methods has to be invoked before setting the parameters. That is done by setting the firstOff element of @PetiteInitMethod, to indicate that init method has to be invoked before parameters injection.
Convention
Parameters are bind to the container using the convention: parameter name starts with the bean name. Example:
PetiteContainerpc=newPetiteContainer();pc.registerBean(Foo.class);// registered as "foo"pc.defineParameter("foo.name","FOONAME");...Foofoo=(Foo)pc.getBean("foo");foo.getName();// "FOONAME"
Parameter References
Sometimes, one parameter has to be injected in several different beans. In order to prevent repeating, it is possible to use parameter references. Parameter reference is a parameter name surrounded with ${} that points to some other parameter. It can occur anywhere in the value string. Nested references are supported as well. Example: