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

instantiate

abstract fun instantiate(bd: RootBeanDefinition, @Nullable beanName: String, owner: BeanFactory): Any

Return an instance of the bean with the given name in this factory.

Parameters

bd - the bean definition

beanName - the name of the bean when it's created in this context. The name can be null if we're autowiring a bean which doesn't belong to the factory.

owner - the owning BeanFactory

Exceptions

BeansException - if the instantiation attempt failed

Return
a bean instance for this bean definition

abstract fun instantiate(bd: RootBeanDefinition, @Nullable beanName: String, owner: BeanFactory, ctor: Constructor<*>, @Nullable vararg args: Any): Any

Return an instance of the bean with the given name in this factory, creating it via the given constructor.

Parameters

bd - the bean definition

beanName - the name of the bean when it's created in this context. The name can be null if we're autowiring a bean which doesn't belong to the factory.

owner - the owning BeanFactory

ctor - the constructor to use

args - the constructor arguments to apply

Exceptions

BeansException - if the instantiation attempt failed

Return
a bean instance for this bean definition

abstract fun instantiate(bd: RootBeanDefinition, @Nullable beanName: String, owner: BeanFactory, @Nullable factoryBean: Any, factoryMethod: Method, @Nullable vararg args: Any): Any

Return an instance of the bean with the given name in this factory, creating it via the given factory method.

Parameters

bd - the bean definition

beanName - the name of the bean when it's created in this context. The name can be null if we're autowiring a bean which doesn't belong to the factory.

owner - the owning BeanFactory

factoryBean - the factory bean instance to call the factory method on, or null in case of a static factory method

factoryMethod - the factory method to use

args - the factory method arguments to apply

Exceptions

BeansException - if the instantiation attempt failed

Return
a bean instance for this bean definition