日期:2014-05-20 浏览次数:21012 次
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver">
</property>
<property name="url" value="jdbc:oracle:thin:@localhost:1521:SUIXIN">
</property>
<property name="username" value="suixin"></property>
<property name="password" value="suixin"></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.Oracle9Dialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>/com/neusoft/crm/model/Employee.hbm.xml</value>
</list>
</property>
</bean>
<bean id="employeeDao" class="com.neusoft.crm.dao.hibernate.EmployeeDaoHibernate"
abstract="false" lazy-init="default" autowire="default"
dependency-check="default">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="employeeManager" class="com.neusoft.service.impl.EmployeeManagerImpl"
abstract="false" lazy-init="default" autowire="default"
dependency-check="default">
<property name="employeeDao">
<ref bean="employeeDao" />
</property>
</bean>
<bean id="addBean" class="com.neusoft.crm.action.EmployeeAction"
scope="prototype">
<property name="employeeManager">
<ref bean="employeeManager" />
</property>
</bean>
<bean id="listBean" class="com.neusoft.crm.action.EmployeeAction"
scope="prototype">
<property name="employeeManager">
<ref bean="employeeManager" />
</property>
</bean>
<bean id="deleteBean" class="com.neusoft.crm.action.EmployeeAction"
scope="prototype">
<property name="employeeManager">
<ref bean="employeeManager" />
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="allManagerMethod" expression="execution (* com.neusoft.crm.service.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod"/>
</aop:config>
</beans>