struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emi Lu <em...@encs.concordia.ca>
Subject Struts2 + Spring + ibatis configuration set in applicationContext-ibatis.xml
Date Wed, 16 Dec 2009 21:43:58 GMT
Hello list,

Struts2 + Spring + ibatis, database connection configuration question:
=============================================================================

(1) In applicationContext-ibatis.xml

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" 
destroy-method="close">
    <property name="driverClassName" value="${driverClassName}" />
    <property name="url"      value="${url}" />
    <property name="username" value="${username}" />
    <property name="password" value="${password}" />
</bean>

<bean id="sqlMapClient" 
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
    <property name="dataSource">
       <ref local="dataSource" />
    </property>

    <property name="configLocation" 
value="WEB-INF/classes/sqlMapConfig.xml" />
    </bean>


My question is in each my action class, do I have to define as the 
following?
<bean id="client1" class="ActionClass1">
       <property name="sqlMapClient" ref="sqlMapClient" />
</bean>

<bean id="client2" class="ActionClass2">
       <property name="sqlMapClient" ref="sqlMapClient" />
</bean>

....

<bean id="clientN" class="ActionClassN">
       <property name="sqlMapClient" ref="sqlMapClient" />
</bean>



So for each my action class I have to define one bean? Is it true or 
there are other simple ways?




Thanks a lot!

--
Lu Ying





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message