58,454
社区成员
发帖
与我相关
我的任务
分享
<action attribute="addLinkForm" input="/updatelinkman.jsp"
name="addLinkForm" path="/updateLink" scope="request"
type="org.springframework.web.struts.DelegatingActionProxy">
<set-property property="cancellable" value="true" />
</action>
<?xml version="1.0" encoding="GB18030"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="url" value="jdbc:mysql://localhost:3306/addressbook?characterEncoding=utf-8"></property>
<property name="username" value="root"></property>
<property name="password" value="root"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/web/po/Unit.hbm.xml</value>
<value>com/web/po/Position.hbm.xml</value>
<value>com/web/po/Department.hbm.xml</value>
<value>com/web/po/Userinfo.hbm.xml</value></list>
</property>
</bean>
<!-- 事务管理器 -->
<bean id="tm" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<!-- advice -->
<bean id="tranadvice" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager">
<ref local="tm"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_REQUIRED</prop>
<prop key="find*">PROPAGATION_REQUIRED</prop>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- 自动代理-->
<bean id="autoProxy" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<list>
<value>*Bo</value>
</list>
</property>
<property name="interceptorNames">
<list>
<value>tranadvice</value>
</list>
</property>
</bean>
<!-- 配置dao -->
<bean id="userinfoDao" class="com.web.dao.UserinfoDao">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<bean id="unitDao" class="com.web.dao.UnitDao">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<bean id="positionDao" class="com.web.dao.PositionDao">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<bean id="departmentDao" class="com.web.dao.DepartmentDao">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<!-- 配置bo -->
<bean id="userinfobo" class="com.web.bo.UserinfoBo">
<property name="userinfodao">
<ref local="userinfoDao"/>
</property>
</bean>
<bean id="unitbo" class="com.web.bo.UnitBo">
<property name="unitdao">
<ref local="unitDao"/>
</property>
</bean>
<bean id="departmentbo" class="com.web.bo.DepartmentBo">
<property name="departmentdao">
<ref local="departmentDao"/>
</property>
</bean>
<bean id="positionbo" class="com.web.bo.PositionBo">
<property name="positiondao">
<ref local="positionDao"/>
</property>
</bean>
<!-- 配置struts-config.xml -->
<bean name="getselect" class="com.web.struts.action.GetSelectAction">
<property name="unitBo">
<ref local="unitbo"/>
</property>
<property name="departmentBo">
<ref local="departmentbo"/>
</property>
<property name="positionBo">
<ref local="positionbo"/>
</property>
</bean>
</beans>