类 BeanDefinitionBuilder
- java.lang.Object
- org.springframework.beans.factory.support.BeanDefinitionBuilder
public class BeanDefinitionBuilder extends Object
Programmatic means of constructingBeanDefinitionsusing the builder pattern. Intended primarily for use when implementing Spring 2.0NamespaceHandlers.- 从以下版本开始:
- 2.0
- 作者:
- Rod Johnson, Rob Harrop, Juergen Hoeller
方法概要
所有方法 静态方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 BeanDefinitionBuilderaddConstructorArg(Object value)已过时。since Spring 2.5, in favor ofaddConstructorArgValue(java.lang.Object).BeanDefinitionBuilderaddConstructorArgReference(String beanName)Add a reference to a named bean as a constructor arg.BeanDefinitionBuilderaddConstructorArgValue(Object value)Add an indexed constructor arg value.BeanDefinitionBuilderaddDependsOn(String beanName)Append the specified bean name to the list of beans that this definition depends on.BeanDefinitionBuilderaddPropertyReference(String name, String beanName)Add a reference to the specified bean name under the property specified.BeanDefinitionBuilderaddPropertyValue(String name, Object value)Add the supplied property value under the given name.static BeanDefinitionBuilderchildBeanDefinition(String parentName)Create a newBeanDefinitionBuilderused to construct aChildBeanDefinition.static BeanDefinitionBuildergenericBeanDefinition()Create a newBeanDefinitionBuilderused to construct aGenericBeanDefinition.static BeanDefinitionBuildergenericBeanDefinition(Class<?> beanClass)Create a newBeanDefinitionBuilderused to construct aGenericBeanDefinition.static BeanDefinitionBuildergenericBeanDefinition(String beanClassName)Create a newBeanDefinitionBuilderused to construct aGenericBeanDefinition.AbstractBeanDefinitiongetBeanDefinition()Validate and return the created BeanDefinition object.AbstractBeanDefinitiongetRawBeanDefinition()Return the current BeanDefinition object in its raw (unvalidated) form.static BeanDefinitionBuilderrootBeanDefinition(Class<?> beanClass)Create a newBeanDefinitionBuilderused to construct aRootBeanDefinition.static BeanDefinitionBuilderrootBeanDefinition(Class<?> beanClass, String factoryMethodName)Create a newBeanDefinitionBuilderused to construct aRootBeanDefinition.static BeanDefinitionBuilderrootBeanDefinition(String beanClassName)Create a newBeanDefinitionBuilderused to construct aRootBeanDefinition.static BeanDefinitionBuilderrootBeanDefinition(String beanClassName, String factoryMethodName)Create a newBeanDefinitionBuilderused to construct aRootBeanDefinition.BeanDefinitionBuildersetAbstract(boolean flag)Set whether or not this definition is abstract.BeanDefinitionBuildersetAutowireMode(int autowireMode)Set the autowire mode for this definition.BeanDefinitionBuildersetDependencyCheck(int dependencyCheck)Set the depency check mode for this definition.BeanDefinitionBuildersetDestroyMethodName(String methodName)Set the destroy method for this definition.BeanDefinitionBuildersetFactoryMethod(String factoryMethod)Set the name of a static factory method to use for this definition, to be called on this bean's class.BeanDefinitionBuildersetFactoryMethodOnBean(String factoryMethod, String factoryBean)Set the name of a non-static factory method to use for this definition, including the bean name of the factory instance to call the method on.BeanDefinitionBuildersetInitMethodName(String methodName)Set the init method for this definition.BeanDefinitionBuildersetLazyInit(boolean lazy)Set whether beans for this definition should be lazily initialized or not.BeanDefinitionBuildersetParentName(String parentName)Set the name of the parent definition of this bean definition.BeanDefinitionBuildersetRole(int role)Set the role of this definition.BeanDefinitionBuildersetScope(String scope)Set the scope of this definition.
方法详细资料
genericBeanDefinition
public static BeanDefinitionBuilder genericBeanDefinition()
Create a newBeanDefinitionBuilderused to construct aGenericBeanDefinition.
genericBeanDefinition
public static BeanDefinitionBuilder genericBeanDefinition(Class<?> beanClass)
Create a newBeanDefinitionBuilderused to construct aGenericBeanDefinition.- 参数:
beanClass- theClassof the bean that the definition is being created for
genericBeanDefinition
public static BeanDefinitionBuilder genericBeanDefinition(String beanClassName)
Create a newBeanDefinitionBuilderused to construct aGenericBeanDefinition.- 参数:
beanClassName- the class name for the bean that the definition is being created for
rootBeanDefinition
public static BeanDefinitionBuilder rootBeanDefinition(Class<?> beanClass)
Create a newBeanDefinitionBuilderused to construct aRootBeanDefinition.- 参数:
beanClass- theClassof the bean that the definition is being created for
rootBeanDefinition
public static BeanDefinitionBuilder rootBeanDefinition(Class<?> beanClass, String factoryMethodName)
Create a newBeanDefinitionBuilderused to construct aRootBeanDefinition.- 参数:
beanClass- theClassof the bean that the definition is being created forfactoryMethodName- the name of the method to use to construct the bean instance
rootBeanDefinition
public static BeanDefinitionBuilder rootBeanDefinition(String beanClassName)
Create a newBeanDefinitionBuilderused to construct aRootBeanDefinition.- 参数:
beanClassName- the class name for the bean that the definition is being created for
rootBeanDefinition
public static BeanDefinitionBuilder rootBeanDefinition(String beanClassName, String factoryMethodName)
Create a newBeanDefinitionBuilderused to construct aRootBeanDefinition.- 参数:
beanClassName- the class name for the bean that the definition is being created forfactoryMethodName- the name of the method to use to construct the bean instance
childBeanDefinition
public static BeanDefinitionBuilder childBeanDefinition(String parentName)
Create a newBeanDefinitionBuilderused to construct aChildBeanDefinition.- 参数:
parentName- the name of the parent bean
getRawBeanDefinition
public AbstractBeanDefinition getRawBeanDefinition()
Return the current BeanDefinition object in its raw (unvalidated) form.- 另请参阅:
getBeanDefinition()
getBeanDefinition
public AbstractBeanDefinition getBeanDefinition()
Validate and return the created BeanDefinition object.
setParentName
public BeanDefinitionBuilder setParentName(String parentName)
Set the name of the parent definition of this bean definition.
setFactoryMethod
public BeanDefinitionBuilder setFactoryMethod(String factoryMethod)
Set the name of a static factory method to use for this definition, to be called on this bean's class.
setFactoryMethodOnBean
public BeanDefinitionBuilder setFactoryMethodOnBean(String factoryMethod, String factoryBean)
Set the name of a non-static factory method to use for this definition, including the bean name of the factory instance to call the method on.- 从以下版本开始:
- 4.3.6
addConstructorArg
@Deprecated public BeanDefinitionBuilder addConstructorArg(Object value)
已过时。since Spring 2.5, in favor ofaddConstructorArgValue(java.lang.Object). This variant just remains around for Spring Security 2.x compatibility.Add an indexed constructor arg value. The current index is tracked internally and all additions are at the present point.
addConstructorArgValue
public BeanDefinitionBuilder addConstructorArgValue(Object value)
Add an indexed constructor arg value. The current index is tracked internally and all additions are at the present point.
addConstructorArgReference
public BeanDefinitionBuilder addConstructorArgReference(String beanName)
Add a reference to a named bean as a constructor arg.
addPropertyValue
public BeanDefinitionBuilder addPropertyValue(String name, Object value)
Add the supplied property value under the given name.
addPropertyReference
public BeanDefinitionBuilder addPropertyReference(String name, String beanName)
Add a reference to the specified bean name under the property specified.- 参数:
name- the name of the property to add the reference tobeanName- the name of the bean being referenced
setInitMethodName
public BeanDefinitionBuilder setInitMethodName(String methodName)
Set the init method for this definition.
setDestroyMethodName
public BeanDefinitionBuilder setDestroyMethodName(String methodName)
Set the destroy method for this definition.
setScope
public BeanDefinitionBuilder setScope(String scope)
Set the scope of this definition.
setAbstract
public BeanDefinitionBuilder setAbstract(boolean flag)
Set whether or not this definition is abstract.
setLazyInit
public BeanDefinitionBuilder setLazyInit(boolean lazy)
Set whether beans for this definition should be lazily initialized or not.
setAutowireMode
public BeanDefinitionBuilder setAutowireMode(int autowireMode)
Set the autowire mode for this definition.
setDependencyCheck
public BeanDefinitionBuilder setDependencyCheck(int dependencyCheck)
Set the depency check mode for this definition.
addDependsOn
public BeanDefinitionBuilder addDependsOn(String beanName)
Append the specified bean name to the list of beans that this definition depends on.
setRole
public BeanDefinitionBuilder setRole(int role)
Set the role of this definition.