spring-framework / org.springframework.beans.factory.support

Package org.springframework.beans.factory.support

Types

AbstractBeanDefinitionReader

abstract class AbstractBeanDefinitionReader : EnvironmentCapable, BeanDefinitionReader

Abstract base class for bean definition readers which implement the BeanDefinitionReader interface.

Provides common properties like the bean factory to work on and the class loader to use for loading bean classes.

AutowireCandidateResolver

interface AutowireCandidateResolver

Strategy interface for determining whether a specific bean definition qualifies as an autowire candidate for a specific dependency.

BeanDefinitionBuilder

open class BeanDefinitionBuilder

Programmatic means of constructing org.springframework.beans.factory.config.BeanDefinition using the builder pattern. Intended primarily for use when implementing Spring 2.0 org.springframework.beans.factory.xml.NamespaceHandler.

BeanDefinitionDefaults

open class BeanDefinitionDefaults

A simple holder for BeanDefinition property defaults.

BeanDefinitionRegistryPostProcessor

interface BeanDefinitionRegistryPostProcessor : BeanFactoryPostProcessor

Extension to the standard BeanFactoryPostProcessor SPI, allowing for the registration of further bean definitions before regular BeanFactoryPostProcessor detection kicks in. In particular, BeanDefinitionRegistryPostProcessor may register further bean definitions which in turn define BeanFactoryPostProcessor instances.

CglibSubclassingInstantiationStrategy

open class CglibSubclassingInstantiationStrategy : SimpleInstantiationStrategy

Default object instantiation strategy for use in BeanFactories.

Uses CGLIB to generate subclasses dynamically if methods need to be overridden by the container to implement Method Injection.

ChildBeanDefinition

open class ChildBeanDefinition : AbstractBeanDefinition

Bean definition for beans which inherit settings from their parent. Child bean definitions have a fixed dependency on a parent bean definition.

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 and/or static 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, dependency check, singleton, lazy init.

NOTE: Since Spring 2.5, the preferred way to register bean definitions programmatically is the GenericBeanDefinition class, which allows to dynamically define parent dependencies through the GenericBeanDefinition#setParentName method. This effectively supersedes the ChildBeanDefinition class for most use cases.

DefaultBeanNameGenerator

open class DefaultBeanNameGenerator : BeanNameGenerator

Default implementation of the BeanNameGenerator interface, delegating to BeanDefinitionReaderUtils#generateBeanName(BeanDefinition, BeanDefinitionRegistry).

GenericBeanDefinition

open class GenericBeanDefinition : AbstractBeanDefinition

GenericBeanDefinition is a one-stop shop for standard bean definition purposes. Like any bean definition, it allows for specifying a class plus optionally constructor argument values and property values. Additionally, deriving from a parent bean definition can be flexibly configured through the "parentName" property.

In general, use this GenericBeanDefinition class for the purpose of registering user-visible bean definitions (which a post-processor might operate on, potentially even reconfiguring the parent name). Use RootBeanDefinition / ChildBeanDefinition where parent/child relationships happen to be pre-determined.

GenericTypeAwareAutowireCandidateResolver

open class GenericTypeAwareAutowireCandidateResolver : SimpleAutowireCandidateResolver, BeanFactoryAware

Basic AutowireCandidateResolver that performs a full generic type match with the candidate's type if the dependency is declared as a generic type (e.g. Repository<Customer>).

This is the base class for org.springframework.beans.factory.annotation.QualifierAnnotationAutowireCandidateResolver, providing an implementation all non-annotation-based resolution steps at this level.

InstantiationStrategy

interface InstantiationStrategy

Interface responsible for creating instances corresponding to a root bean definition.

This is pulled out into a strategy as various approaches are possible, including using CGLIB to create subclasses on the fly to support Method Injection.

LookupOverride

open class LookupOverride : MethodOverride

Represents an override of a method that looks up an object in the same IoC context.

Methods eligible for lookup override must not have arguments.

ManagedArray

open class ManagedArray : ManagedList<Any>

Tag collection class used to hold managed array elements, which may include runtime bean references (to be resolved into bean objects).

ManagedList

open class ManagedList<E : Any> : ArrayList<E>, Mergeable, BeanMetadataElement

Tag collection class used to hold managed List elements, which may include runtime bean references (to be resolved into bean objects).

ManagedMap

open class ManagedMap<K : Any, V : Any> : LinkedHashMap<K, V>, Mergeable, BeanMetadataElement

Tag collection class used to hold managed Map values, which may include runtime bean references (to be resolved into bean objects).

ManagedProperties

open class ManagedProperties : Properties, Mergeable, BeanMetadataElement

Tag class which represents a Spring-managed Properties instance that supports merging of parent/child definitions.

ManagedSet

open class ManagedSet<E : Any> : LinkedHashSet<E>, Mergeable, BeanMetadataElement

Tag collection class used to hold managed Set values, which may include runtime bean references (to be resolved into bean objects).

MergedBeanDefinitionPostProcessor

interface MergedBeanDefinitionPostProcessor : BeanPostProcessor

Post-processor callback interface for merged bean definitions at runtime. BeanPostProcessor implementations may implement this sub-interface in order to post-process the merged bean definition (a processed copy of the original bean definition) that the Spring BeanFactory uses to create a bean instance.

The #postProcessMergedBeanDefinition method may for example introspect the bean definition in order to prepare some cached metadata before post-processing actual instances of a bean. It is also allowed to modify the bean definition but only for definition properties which are actually intended for concurrent modification. Essentially, this only applies to operations defined on the RootBeanDefinition itself but not to the properties of its base classes.

MethodOverrides

open class MethodOverrides

Set of method overrides, determining which, if any, methods on a managed object the Spring IoC container will override at runtime.

The currently supported MethodOverride variants are LookupOverride and ReplaceOverride.

MethodReplacer

interface MethodReplacer

Interface to be implemented by classes that can reimplement any method on an IoC-managed object: the Method Injection form of Dependency Injection.

Such methods may be (but need not be) abstract, in which case the container will create a concrete subclass to instantiate.

PropertiesBeanDefinitionReader

open class PropertiesBeanDefinitionReader : AbstractBeanDefinitionReader

Bean definition reader for a simple properties format.

Provides bean definition registration methods for Map/Properties and ResourceBundle. Typically applied to a DefaultListableBeanFactory.

Example:

 employee.(class)=MyClass // bean is of class MyClass employee.(abstract)=true // this bean can't be instantiated directly employee.group=Insurance // real property employee.usesDialUp=false // real property (potentially overridden) salesrep.(parent)=employee // derives from "employee" bean definition salesrep.(lazy-init)=true // lazily initialize this singleton bean salesrep.manager(ref)=tony // reference to another bean salesrep.department=Sales // real property techie.(parent)=employee // derives from "employee" bean definition techie.(scope)=prototype // bean is a prototype (not a shared instance) techie.manager(ref)=jeff // reference to another bean techie.department=Engineering // real property techie.usesDialUp=true // real property (overriding parent value) ceo.$0(ref)=secretary // inject 'secretary' bean as 0th constructor arg ceo.$1=1000000 // inject value '1000000' at 1st constructor arg 

ReplaceOverride

open class ReplaceOverride : MethodOverride

Extension of MethodOverride that represents an arbitrary override of a method by the IoC container.

Any non-final method can be overridden, irrespective of its parameters and return types.

SimpleAutowireCandidateResolver

open class SimpleAutowireCandidateResolver : AutowireCandidateResolver

AutowireCandidateResolver implementation to use when no annotation support is available. This implementation checks the bean definition only.

SimpleBeanDefinitionRegistry

open class SimpleBeanDefinitionRegistry : SimpleAliasRegistry, BeanDefinitionRegistry

Simple implementation of the BeanDefinitionRegistry interface. Provides registry capabilities only, with no factory capabilities built in. Can for example be used for testing bean definition readers.

SimpleInstantiationStrategy

open class SimpleInstantiationStrategy : InstantiationStrategy

Simple object instantiation strategy for use in a BeanFactory.

Does not support Method Injection, although it provides hooks for subclasses to override to add Method Injection support, for example by overriding methods.

SimpleSecurityContextProvider

open class SimpleSecurityContextProvider : SecurityContextProvider

Simple SecurityContextProvider implementation.

StaticListableBeanFactory

open class StaticListableBeanFactory : ListableBeanFactory

Static org.springframework.beans.factory.BeanFactory implementation which allows to register existing singleton instances programmatically. Does not have support for prototype beans or aliases.

Serves as example for a simple implementation of the org.springframework.beans.factory.ListableBeanFactory interface, managing existing bean instances rather than creating new ones based on bean definitions, and not implementing any extended SPI interfaces (such as org.springframework.beans.factory.config.ConfigurableBeanFactory).

For a full-fledged factory based on bean definitions, have a look at DefaultListableBeanFactory.

Exceptions

BeanDefinitionValidationException

open class BeanDefinitionValidationException : FatalBeanException

Exception thrown when the validation of a bean definition failed.