Here I am writing a spring application, here I want to do is like this:
<bean id="sqlClient" class="com.braoda.dao.sqclient.SqlclientWapper">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="userDao" class="com.braoda.dao.user.UserDaoImpl">
<property name="sqlSession" ref="***sqlClient.SqlSessionFactoryBean***" />
As the code like, I want use the spring Xml property config from "ref", but "ref" is not a bean but a bean's property. is this illegal in spring or we can not use spring like this.
Yes, it is possible.
have a look at http://forum.spring.io/forum/spring-projects/container/35869-reference-bean-property-within-reference
which shows code like <property name="username" value="${local.username}"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With