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 |
---|---|
java.lang.Object |
instantiate(RootBeanDefinition beanDefinition,
java.lang.String beanName,
BeanFactory owner)
Return an instance of the bean with the given name in this factory.
|
java.lang.Object |
instantiate(RootBeanDefinition beanDefinition,
java.lang.String beanName,
BeanFactory owner,
java.lang.reflect.Constructor<?> ctor,
java.lang.Object[] args)
Return an instance of the bean with the given name in this factory,
creating it via the given constructor.
|
java.lang.Object |
instantiate(RootBeanDefinition beanDefinition,
java.lang.String beanName,
BeanFactory owner,
java.lang.Object factoryBean,
java.lang.reflect.Method factoryMethod,
java.lang.Object[] args)
Return an instance of the bean with the given name in this factory,
creating it via the given factory method.
|
java.lang.Object instantiate(RootBeanDefinition beanDefinition, java.lang.String beanName, BeanFactory owner) throws BeansException
beanDefinition
- the bean definitionbeanName
- name of the bean when it's created in this context.
The name can be null
if we're autowiring a bean that
doesn't belong to the factory.owner
- owning BeanFactoryBeansException
- if the instantiation failedjava.lang.Object instantiate(RootBeanDefinition beanDefinition, java.lang.String beanName, BeanFactory owner, java.lang.reflect.Constructor<?> ctor, java.lang.Object[] args) throws BeansException
beanDefinition
- the bean definitionbeanName
- name of the bean when it's created in this context.
The name can be null
if we're autowiring a bean
that doesn't belong to the factory.owner
- owning BeanFactoryctor
- the constructor to useargs
- the constructor arguments to applyBeansException
- if the instantiation failedjava.lang.Object instantiate(RootBeanDefinition beanDefinition, java.lang.String beanName, BeanFactory owner, java.lang.Object factoryBean, java.lang.reflect.Method factoryMethod, java.lang.Object[] args) throws BeansException
beanDefinition
- bean definitionbeanName
- name of the bean when it's created in this context.
The name can be null
if we're autowiring a bean
that doesn't belong to the factory.owner
- 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 failed