-
Oct 27th, 2005, 10:26 AM
#1
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">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="interceptor">
<ref bean="interceptor" />
</property>
</bean>
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....
Thanks
Lawrie
Lawrie Nichols
-
Oct 27th, 2005, 10:58 AM
#2
Not sure I understand the exact problem you are trying to solve - maybe ConfigurableListableBeanFactory.BeanDefinition is what you are looking for?
--Jing Xue
-
Oct 27th, 2005, 12:21 PM
#3
What's your use case? You could implement BeanNameAware in your classes, but that's normally tying them too tightly to the container.
Randy
-
Oct 28th, 2005, 12:51 AM
#4
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).
regards,
Alef
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules