spring-BeanDefinition

官网springframework 5.3.20 API

BeanDefinition

概述

A BeanDefinition describes a bean instance, which has property values, constructor argument values, and further information supplied by concrete implementations.
This is just a minimal interface: The main intention is to allow a BeanFactoryPostProcessor to introspect and modify property values and other bean metadata.

BeanDefinition描述一个bean实例,该实例具有属性值、构造函数参数值以及具体实现提供的进一步信息。

这只是一个最小的接口:主要目的是允许BeanFactoryPostProcessor内省和修改属性值和其他bean元数据。

方法

setBeanClassName

Specify the bean class name of this bean definition.

The class name can be modified during bean factory post-processing, typically replacing the original class name with a parsed variant of it.

用于指定bean的类型

setScope

Override the target scope of this bean, specifying a new scope name.

更改bean的作用域

isLazyInit

Return whether this bean should be lazily initialized, i.e. not eagerly instantiated on startup. Only applicable to a singleton bean.

返回这个bean是否延迟初始化。

setDependsOn

Set the names of the beans that this bean depends on being initialized. The bean factory will guarantee that these beans get initialized first.

设置此bean依赖于初始化的bean的名称。bean工厂将保证这些bean首先得到初始化。

isPrimary

Return whether this bean is a primary autowire candidate.

返回此bean是否为主要autowire候选。

setInitMethodName

Set the name of the initializer method.

设置初始化方法名称。

  • spring
    • Bean Definition