public interface InstantiationStrategy
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.
Modifier and Type | Method and Description |
---|---|
Object |
instantiate(RootBeanDefinition bd,
String beanName,
BeanFactory owner)
Return an instance of the bean with the given name in this factory.
|
Object |
instantiate(RootBeanDefinition bd,
String beanName,
BeanFactory owner,
Constructor<?> ctor,
Object... args)
Return an instance of the bean with the given name in this factory,
creating it via the given constructor.
|
Object |
instantiate(RootBeanDefinition bd,
String beanName,
BeanFactory owner,
Object factoryBean,
Method factoryMethod,
Object... args)
Return an instance of the bean with the given name in this factory,
creating it via the given factory method.
|
Object instantiate(RootBeanDefinition bd, @Nullable String beanName, BeanFactory owner) throws BeansException
bd
- the bean definitionbeanName
- the name of the bean when it is created in this context.
The name can be null
if we are autowiring a bean which doesn't
belong to the factory.owner
- the owning BeanFactoryBeansException
- if the instantiation attempt failedObject instantiate(RootBeanDefinition bd, @Nullable String beanName, BeanFactory owner, Constructor<?> ctor, Object... args) throws BeansException
bd
- the bean definitionbeanName
- the name of the bean when it is created in this context.
The name can be null
if we are autowiring a bean which doesn't
belong to the factory.owner
- the owning BeanFactoryctor
- the constructor to useargs
- the constructor arguments to applyBeansException
- if the instantiation attempt failedObject instantiate(RootBeanDefinition bd, @Nullable String beanName, BeanFactory owner, @Nullable Object factoryBean, Method factoryMethod, Object... args) throws BeansException
bd
- the bean definitionbeanName
- the name of the bean when it is created in this context.
The name can be null
if we are autowiring a bean which doesn't
belong to the factory.owner
- the owning BeanFactoryfactoryBean
- the factory bean instance to call the factory method on,
or null
in case of a static factory methodfactoryMethod
- the factory method to useargs
- the factory method arguments to applyBeansException
- if the instantiation attempt failed