Although each Nuts tag has its own set of attributes, there are a few attributes that are common to either several or most of the tags:
Fundamentals
- singleton.
- Applied to any Component tag.
- It indicates whether we want singleton pattern applied to this Component.
- Allowed values are: true, false, thread.
- Default value: The global default value is used for global components; "false" for local and sub components.
- Custom autowire mode can be registered.
- type.
- Applied to any Component tag.
- It explicitly declare the type of the component.
- Also applied to literal tags such as <value>, <arg>, <prop>.
- It converts the string literal to the target type.
- Optional attribute.
- id.
- Applied to any tag declared in the global scope or inside <local>, <sequence>, <binder> tags.
- Allowed values: any valid id. No duplicate id allowed in the same scope.
- Mandatory attribute wherever applicable.
- var.
- Applied to the <binder> tag to indicate a bound variable.
- Applied to sub-tags inside <sequence> and <binder> to declare local variables.
- Allowed values: any valid id. No duplicate var allowed in the same scope.
- var and id cannot duplicate either.
- Mandatory attribute for <binder>.
- component.
- Applied to many tags that accepts another Component. <bean>, <method>, <getter>, <setter>, <bind> all support this attribute.
- Allowed values: any visible id or var.
Life Cycle attributes
- initializer.
- Lifecycle specifier. Indicates which method to call to initialize it.
- Allowed value: any valid method name.
- Default value: n/a.
- disposer.
- Lifecycle specifier. Indicates which method to call to dispose of it.
- Allowed value: any valid method name.
- Default value: n/a.
- starter.
- Lifecycle specifier. Indicates which method to call to start it.
- Allowed value: any valid method name.
- Default value: n/a.
- stopper.
- Lifecycle specifier. Indicates which method to call to stopper it.
- Allowed value: any valid method name.
- Default value: n/a.
These life cycle attributes are supported by <ctor>, <method>, <bean> tags.
Miscillaneous
- autowire.
- Applied to any Component tag.
- It indicates whether the component use auto-wiring to resolve dependency.
- allowed values are: none, bytype, byname, byQualifiedName, autodetect.
- Default value: none.
- Custom autowire modes can be resitered. See Custom Autowire Mode - EJB3 style for details.
- eager-init.
- Applied to any component declared at the global scope.
- It indicates whether the component is eagerly instantiated.
- allowed values are: true, false, yes, no, on, off.
- Default value: specified by the global "eager-init" setting. "false" is global setting is not specified.
- private-access.
- Applicable to <ctor>, <method>, <field>.
- It indicates whether we allow access to non-public members.
- Allowed values: true, false.
- Default value: false.
- synchronized.
- Applicable to every tag that evaluates to a Component.
- It indicates whether the component instantiation is in a "synchronized" block to ensure thread safety. Operations done by Nuts and Yan (such as singleton) are always thread-safe regardless of this attribute. "synchronized" attribute can be used to protect method calls and java bean setters or their combinations that could be used in a multi-threaded environment.
- Allowed values: true, false.
- Default value: false.
- servlet-context-property
- Applicable to <ctor>, <method> and <bean> in web integration.
- Default value: "servletContext". So if the component has a method "setServletContext" with one ServletContext parameter, it will be called to set the ServletContext.
- Setting "servlet-context-property" to "$null" or "" suppresses it.
Created by benyu benyu
On Mon Nov 14 23:31:13 CST 2005
Using TimTam
