Oct 27th, 2005, 10:26 AM
How can you find the names of beans used as properties ?
Is there any way for a 'bean' to find out the 'names/ids' of other beans that have been used as properties (including beans set by autowiring) ? For example :
<bean id="service" class="MyService">
<ref bean="dataSource" />
<ref bean="interceptor" />
Is there some mecahnism by which sessionFactory would be able to find out that it's dataSource property was set using the 'dataSource' bean ? Im also looking to try and do this with anonymous 'inner' beans as well....
Oct 27th, 2005, 10:58 AM
Not sure I understand the exact problem you are trying to solve - maybe ConfigurableListableBeanFactory.BeanDefinition is what you are looking for?
Oct 27th, 2005, 12:21 PM
What's your use case? You could implement BeanNameAware in your classes, but that's normally tying them too tightly to the container.
Oct 28th, 2005, 12:51 AM
It's not possible for the session factory to know the bean name of its dependencies (unless you would be implementing BeanNameAware in the dependency and cast the dependency in the session factory).