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

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.

Author
Rod Johnson

Author
Juergen Hoeller

Since
1.1

Functions

instantiate

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

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

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

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

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

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

Inheritors

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.