java - How to inject a Spring bean id into another Spring Configured Bean? -
i want able pass bean id bean reference. if have this:
<bean id="specialname" class="my.specialbean"/> <bean id="referencebean" class="my.referencebean"> <property name="refid" value="<specialname.name>"/> </bean> public class referencebean { // spring injected value of should 'specialname' public string refid; // getter & setter refid } the reason need this, referencebean route builder in camel , directs messages specialbean through spring registry. i'm new spring , camel, if ill conceived questions, apologies.
you can use spring-el -
<bean id="specialname" class="my.specialbean"/> <bean id="referencebean" class="my.referencebean"> <property name="refid" value="#{specialname.name}"/> </bean>
Comments
Post a Comment