public class SimpleInstantiationStrategy extends java.lang.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 java.lang.reflect.Method |
getCurrentlyInvokedFactoryMethod()
Return the factory method currently being invoked or
null if none. |
java.lang.Object |
instantiate(RootBeanDefinition bd,
java.lang.String beanName,
BeanFactory owner)
Return an instance of the bean with the given name in this factory.
|
java.lang.Object |
instantiate(RootBeanDefinition bd,
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 bd,
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.
|
protected java.lang.Object |
instantiateWithMethodInjection(RootBeanDefinition bd,
java.lang.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 java.lang.Object |
instantiateWithMethodInjection(RootBeanDefinition bd,
java.lang.String beanName,
BeanFactory owner,
java.lang.reflect.Constructor<?> ctor,
java.lang.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 java.lang.reflect.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 java.lang.Object instantiate(RootBeanDefinition bd, java.lang.String beanName, BeanFactory owner)
InstantiationStrategy
instantiate
in interface InstantiationStrategy
bd
- the bean definitionbeanName
- 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 BeanFactoryprotected java.lang.Object instantiateWithMethodInjection(RootBeanDefinition bd, java.lang.String beanName, BeanFactory owner)
public java.lang.Object instantiate(RootBeanDefinition bd, java.lang.String beanName, BeanFactory owner, java.lang.reflect.Constructor<?> ctor, java.lang.Object... args)
InstantiationStrategy
instantiate
in interface InstantiationStrategy
bd
- the bean definitionbeanName
- 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 BeanFactoryctor
- the constructor to useargs
- the constructor arguments to applyprotected java.lang.Object instantiateWithMethodInjection(RootBeanDefinition bd, java.lang.String beanName, BeanFactory owner, java.lang.reflect.Constructor<?> ctor, java.lang.Object... args)
public java.lang.Object instantiate(RootBeanDefinition bd, java.lang.String beanName, BeanFactory owner, java.lang.Object factoryBean, java.lang.reflect.Method factoryMethod, java.lang.Object... args)
InstantiationStrategy
instantiate
in interface InstantiationStrategy
bd
- the bean definitionbeanName
- 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 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