public class SimpleInstantiationStrategy extends Object implements InstantiationStrategy
Does not support Method Injection, although it provides hooks for subclasses to override to add Method Injection support, for example by overriding methods.
Constructor and Description |
---|
SimpleInstantiationStrategy() |
Modifier and Type | Method and Description |
---|---|
static Method |
getCurrentlyInvokedFactoryMethod()
Return the factory method currently being invoked or
null if none. |
Object |
instantiate(RootBeanDefinition beanDefinition,
String beanName,
BeanFactory owner)
Return an instance of the bean with the given name in this factory.
|
Object |
instantiate(RootBeanDefinition beanDefinition,
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 beanDefinition,
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.
|
protected Object |
instantiateWithMethodInjection(RootBeanDefinition beanDefinition,
String beanName,
BeanFactory owner)
Subclasses can override this method, which is implemented to throw
UnsupportedOperationException, if they can instantiate an object with
the Method Injection specified in the given RootBeanDefinition.
|
protected Object |
instantiateWithMethodInjection(RootBeanDefinition beanDefinition,
String beanName,
BeanFactory owner,
Constructor<?> ctor,
Object[] args)
Subclasses can override this method, which is implemented to throw
UnsupportedOperationException, if they can instantiate an object with
the Method Injection specified in the given RootBeanDefinition.
|
public static Method getCurrentlyInvokedFactoryMethod()
null
if none.
Allows factory method implementations to determine whether the current caller is the container itself as opposed to user code.
public Object instantiate(RootBeanDefinition beanDefinition, String beanName, BeanFactory owner)
InstantiationStrategy
instantiate
in interface InstantiationStrategy
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 BeanFactoryprotected Object instantiateWithMethodInjection(RootBeanDefinition beanDefinition, String beanName, BeanFactory owner)
public Object instantiate(RootBeanDefinition beanDefinition, String beanName, BeanFactory owner, Constructor<?> ctor, Object[] args)
InstantiationStrategy
instantiate
in interface InstantiationStrategy
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 applyprotected Object instantiateWithMethodInjection(RootBeanDefinition beanDefinition, String beanName, BeanFactory owner, Constructor<?> ctor, Object[] args)
public Object instantiate(RootBeanDefinition beanDefinition, String beanName, BeanFactory owner, Object factoryBean, Method factoryMethod, Object[] args)
InstantiationStrategy
instantiate
in interface InstantiationStrategy
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 apply