I do not know how to articulate/search the issue in the first place.
So the bean initialized are :
<bean id='domain' factory-bean='appConfig' factory-method='getDomain'/
<bean id='prod' class='java.lang.String'> <constructor-arg value='Base.Prod'/> </bean>
<bean id='test' class='java.lang.String'> <constructor-arg value='Base.Beta' /> </bean>
Now I need to create a bean "X" using the value of Prod or Test depending on the value of domain. If domain is Prod,use the bean of Prod to initialize bean X else use Test.
${${domain}} does not work. I tried searching but was not able to find a question that meant this.
Finally found the answer. There is a way to refer the test/prod bean through domain. You just got to use #{domain}. More information here: spEL
Use it as :
<bean id="ThatBean" class="whicheverClass">
<constructor-arg ref="#{domain}" />
</bean>