Showing:

Annotations
Attributes
Model
Properties
Element bean
Namespace http://www.springframework.org/schema/beans
Annotations

java:org.springframework.beans.factory.config.BeanDefinition

Defines a single (usually named) bean.

	A bean definition may contain nested tags for constructor arguments,
	property values, lookup methods, and replaced methods. Mixing constructor
	injection and setter injection on the same bean is explicitly supported.
Type extension of identifiedType
Type hierarchy
Properties
content complex
Model
description{0,1} , (meta | constructor-arg | property | qualifier | lookup-method | replaced-method | ANY element from ANY namespace OTHER than 'http://www.springframework.org/schema/beans')
Children constructor-arg, description, lookup-method, meta, property, qualifier, replaced-method
Attributes
QName Type Default Use Annotation
abstract xsd:boolean optional
Is this bean "abstract", that is, not meant to be instantiated itself
	but rather just serving as parent for concrete child bean definitions?
	The default is "false". Specify "true" to tell the bean factory to not
	try to instantiate that particular bean in any case.

	Note: This attribute will not be inherited by child bean definitions.
	Hence, it needs to be specified per abstract bean definition.
autowire restriction of xsd:NMTOKEN default optional
Controls whether bean properties are "autowired".
	This is an automagical process in which bean references don't need
	to be coded explicitly in the XML bean definition file, but rather the
	Spring container works out dependencies. The effective default is "no".

	There are 4 modes:

	1. "no"
	The traditional Spring default. No automagical wiring. Bean references
	must be defined in the XML file via the <ref/> element (or "ref"
	attribute). We recommend this in most cases as it makes documentation
	more explicit.

	Note that this default mode also allows for annotation-driven autowiring,
	if activated. "no" refers to externally driven autowiring only, not
	affecting any autowiring demands that the bean class itself expresses.

	2. "byName"
	Autowiring by property name. If a bean of class Cat exposes a "dog"
	property, Spring will try to set this to the value of the bean "dog"
	in the current container. If there is no matching bean by name, nothing
	special happens.

	3. "byType"
	Autowiring if there is exactly one bean of the property type in the
	container. If there is more than one, a fatal error is raised, and
	you cannot use byType autowiring for that bean. If there is none,
	nothing special happens.

	4. "constructor"
	Analogous to "byType" for constructor arguments. If there is not exactly
	one bean of the constructor argument type in the bean factory, a fatal
	error is raised.

	Note that explicit dependencies, i.e. "property" and "constructor-arg"
	elements, always override autowiring.

	Note: This attribute will not be inherited by child bean definitions.
	Hence, it needs to be specified per concrete bean definition. It can be
	shared through the 'default-autowire' attribute at the 'beans' level
	and potentially inherited from outer 'beans' defaults in case of nested
	'beans' sections (e.g. with different profiles).
autowire-candidate defaultable-boolean default optional
Indicates whether or not this bean should be considered when looking
for matching candidates to satisfy another bean's autowiring requirements.
Note that this does not affect explicit references by name, which will get
resolved even if the specified bean is not marked as an autowire candidate.
class xsd:string optional

java:java.lang.Class

The fully qualified name of the bean's class, except if it serves only
as a parent definition for child bean definitions.
depends-on xsd:string optional
The names of the beans that this bean depends on being initialized.
	The bean factory will guarantee that these beans get initialized
	before this bean.

	Note that dependencies are normally expressed through bean properties
	or constructor arguments. This property should just be necessary for
	other kinds of dependencies like statics (*ugh*) or database preparation
	on startup.

	Note: This attribute will not be inherited by child bean definitions.
	Hence, it needs to be specified per concrete bean definition.
destroy-method xsd:string optional
The name of the custom destroy method to invoke on bean factory shutdown.
	The method must have no arguments, but may throw any exception.

	This is an alternative to implementing Spring's DisposableBean
	interface or the standard Java Closeable/AutoCloseable interface,
	or marking a method with the PreDestroy annotation.

	Note: Only invoked on beans whose lifecycle is under the full
	control of the factory - which is always the case for singletons,
	but not guaranteed for any other scope.
factory-bean xsd:string optional
Alternative to class attribute for factory-method usage.
If this is specified, no class attribute should be used.
This must be set to the name of a bean in the current or
ancestor factories that contains the relevant factory method.
This allows the factory itself to be configured using Dependency
Injection, and an instance (rather than static) method to be used.
factory-method xsd:string optional
The name of a factory method to use to create this object. Use
	constructor-arg elements to specify arguments to the factory method,
	if it takes arguments. Autowiring does not apply to factory methods.

	If the "class" attribute is present, the factory method will be a static
	method on the class specified by the "class" attribute on this bean
	definition. Often this will be the same class as that of the constructed
	object - for example, when the factory method is used as an alternative
	to a constructor. However, it may be on a different class. In that case,
	the created object will *not* be of the class specified in the "class"
	attribute. This is analogous to FactoryBean behavior.

	If the "factory-bean" attribute is present, the "class" attribute is not
	used, and the factory method will be an instance method on the object
	returned from a getBean call with the specified bean name. The factory
	bean may be defined as a singleton or a prototype.

	The factory method can have any number of arguments. Autowiring is not
	supported. Use indexed constructor-arg elements in conjunction with the
	factory-method attribute.

	Setter Injection can be used in conjunction with a factory method.
	Method Injection cannot, as the factory method returns an instance,
	which will be used when the container creates the bean.
id xsd:string optional
The unique identifier for a bean. A bean id may not be used more than once
within the same <beans> element.
init-method xsd:string optional
The name of the custom initialization method to invoke after setting
	bean properties. The method must have no arguments, but may throw any
	exception.

	This is an alternative to implementing Spring's InitializingBean
	interface or marking a method with the PostConstruct annotation.
lazy-init defaultable-boolean default optional
Indicates whether this bean is to be lazily initialized. If "false",
	it will be instantiated on startup by bean factories that perform eager
	initialization of singletons. The effective default is "false".

	Note: This attribute will not be inherited by child bean definitions.
	Hence, it needs to be specified per concrete bean definition. It can be
	shared through the 'default-lazy-init' attribute at the 'beans' level
	and potentially inherited from outer 'beans' defaults in case of nested
	'beans' sections (e.g. with different profiles).
name xsd:string optional
Can be used to create one or more aliases illegal in an (XML) id.
Multiple aliases can be separated by any number of spaces, commas,
or semi-colons (or indeed any mixture of the three).
parent xsd:string optional
The name of the parent bean definition.

	Will use the bean class of the parent if none is specified, but can
	also override it. In the latter case, the child bean class must be
	compatible with the parent, i.e. accept the parent's property values
	and constructor argument values, if any.

	A child bean definition will inherit constructor argument values,
	property values and method overrides from the parent, with the option
	to add new values. If init method, destroy method, factory bean and/or
	factory method are specified, they will override the corresponding
	parent settings.

	The remaining settings will always be taken from the child definition:
	depends on, autowire mode, scope, lazy init.
primary xsd:boolean optional
Specifies that this bean should be given preference when multiple
candidates are qualified to autowire a single-valued dependency.
If exactly one 'primary' bean exists among the candidates, it
will be the autowired value.
scope xsd:string optional
The scope of this bean: typically "singleton" (one shared instance,
	which will be returned by all calls to getBean with the given id), or
	"prototype" (independent instance resulting from each call to getBean).

	By default, a bean will be a singleton, unless the bean has a parent
	bean definition in which case it will inherit the parent's scope.

	Singletons are most commonly used, and are ideal for multi-threaded
	service objects. Further scopes, such as "request" or "session", might
	be supported by extended bean factories (e.g. in a web environment).

	Inner bean definitions inherit the scope of their containing bean
	definition, unless explicitly specified: The inner bean will be a
	singleton if the containing bean is a singleton, and a prototype if
	the containing bean is a prototype, etc.
Wildcard: ANY attribute from ANY namespace OTHER than 'http://www.springframework.org/schema/beans'