I have like:
<bean id="beansInst" factory="beanFactory" factory-method="getInstance" />
In factory bean:
Object getInstance() {
....
String beanName= ????;
}
How I can receive name of bean that in this moment calls this method?
And second question: Do I have this method (getInstance) synchronized?
Thanks.
You’d need to implement
BeanNameAware. Then the container invokes thesetBeanNamemethods and provide the name value. You can then set the beanName property in that method.