Spring动态代理使用

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
    <description>定义业务层和集成层对象,包括Action、Service、BO、DAO、SAO、EJB、JNDI资源</description>


    <!--=====================================================================-->
    <!-- JNDI定义 -->
    <!--=====================================================================-->
   <!--
   <bean id="jndiTemplate"  class="org.springframework.jndi.JndiTemplate">
        <description>定义一个用作模板的JNDI,可以被其它bean引用</description>
        <property name="environment">
            <props>
                <prop key="java.naming.provider.url">${java.naming.jndi.url}</prop>
                <prop key="java.naming.factory.initial">${java.naming.factory.initial}</prop>
            </props>
        </property>
    </bean>
    -->
    <!--=====================================================================-->
    <!-- 数据源定义一 -->
    <!--=====================================================================-->


    <bean id="myDataSource"
        class="org.springframework.jndi.JndiObjectFactoryBean">
         <property name="jndiName">
          <value>${MY_DATA_SOURCE_JNDI}</value>
        </property>
        <!--
        <property name="jndiEnvironment"> 
    <props> 
        <prop key="java.naming.provider.url">t3://localhost:7001</prop> 
      <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop> 
    </props> 
</property>
        <property name="jndiTemplate">
            <ref local="jndiTemplate"/>
        </property>
        -->
    </bean>


    <!--=====================================================================-->
    <!-- 数据源定义方式二(本地调试使用连接池) -->
    <!--===================================================================== -->
    <bean id="dataSourceAB" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
      <property name="driverClassName">
       <value>oracle.jdbc.driver.OracleDriver</value>
      </property>
      <property name="url">
       <value>${DATA_SOURC_AB_CONNECT_STRING}</value>
      </property>
      <property name="username">
       <value>${DATA_SOURC_AB_USER_NAME}</value>
      </property>
      <property name="password">
       <value>${DATA_SOURC_AB_PASSWORD}</value>
      </property>
     </bean>
     <bean id="sessionFactoryAB" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource"><ref bean="dataSourceAB"/></property>
        <property name="configLocation">
            <value>classpath:com/isoftstone/pcis/prod/res/hibernateAB.cfg.xml</value>
        </property>
        <property name="hibernateProperties">
          <props>
              <prop key="show_sql">${SHOW_SQL_ONOFF}</prop>
              <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9iDialect</prop>
          </props>
        </property>
      </bean>


   <!--=====================================================================-->
   <!-- Hibernate信息的相关配置 -->
   <!--=====================================================================-->
 <!--=====================================================================-->
 <!-- 不采用hibernate.cfg.xml -->
 <!--=====================================================================-->
 <!--
  <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource"><ref bean="isoftstoneTestDS" /></property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">
                    org.hibernate.dialect.Oracle9iDialect or org.hibernate.dialect.MySQL5Dialect
                </prop>
                <prop key="hibernate.show_sql">false</prop>
                <prop key="hibernate.jdbc.batch_size">10</prop>
            </props>
        </property>
        <property name="mappingResources">
            <list>
                <value>com/isoftstone/ai/test/bo/config/user.hbm.xml</value>
            </list>
        </property>
    </bean>
   -->
 <!--=====================================================================-->
 <!-- 采用hibernate.cfg.xml -->
 <!--=====================================================================-->


 <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
        <ref bean="myDataSource" />
    </property>
    <!-- 处理大字段 -->
    <property name="lobHandler">
        <ref bean="defaultLobHandler" />
    </property>


    <!-- 单个文件
    <property name="configLocation">
        <value>classpath:hibernate.cfg.xml</value>
    </property>
    -->
    <!-- 配置多个文件 -->
    <property name="configLocations">
        <list>
            <value>classpath:com/isoftstone/pcis/sys/res/hibernate-core.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/sys/res/hibernate-sys-right.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/sys/res/hibernate-sys-common.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/sys/res/hibernate-sys-fin.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/sys/res/hibernate-org.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/sys/res/hibernate-cus.cfg.xml</value>
            <value>core/conf/hibernate-tool.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/product/res/hibernate-product.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/prod/res/hibernate-prod.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/policy/res/hibernate-policy.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/policy/res/hibernate-policy-config-endorse.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/policy/res/hibernate-policy-inq.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/underwrite/res/hibernate-underwrite.cfg.xml</value>
            <!-- 原来的平台和见费出单 -->
            <!--<value>classpath:com/isoftstone/pcis/intf/res/hibernate-intf.cfg.xml</value>-->
            <!-- hjt add 连接platform文件begin -->
            <value>classpath:com/isoftstone/pcis/platform/res/hibernate-platform.cfg.xml</value>
            <!-- hjt add 连接platform文件end -->
            <!-- 见费出单VO映射 add by wangbinbin -->
            <value>classpath:com/isoftstone/pcis/payseemoney/res/hibernate-policy-payseemoney.cfg.xml</value>
            <!-- 见费出单VO映射 add by wangbinbin -->
            <value>classpath:com/isoftstone/pcis/vch/res/hibernate-vch.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/payseemoney/res/hibernate-policy-payseemoney.cfg.xml</value> 
            <value>classpath:com/isoftstone/pcis/res/hibernate-undr.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/res/hibernate-emrlevel.cfg.xml</value>
            
            <value>classpath:com/isoftstone/pcis/fin/res/hibernate-fin.cfg.xml</value>
            <value>classpath:conf/hibernate.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/claim/res/hibernate-clm.cfg.xml</value>
           <!-- 再保VO映射-->
            <value>classpath:com/isoftstone/pcis/reinsure/res/hibernate-riskunit.cfg.xml</value>
<!-- 再保VO映射-->
<!-- 收付接口映射VO -->
<value>classpath:com/isoftstone/pcis/fin/res/hibernate-fenet-fin.cfg.xml</value>
<!-- 新能源配置 -->
<value>classpath:com/isoftstone/pcis/vstaxlevy/res/hibernate-policy-vstaxlevy.cfg.xml</value>
            <!--




            <value>classpath:com/isoftstone/pcis/sys/res/hibernate-undr.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/sys/res/hibernate-vch.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/sys/res/hibernate-fin.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/sys/res/hibernate-emrlevel.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/sys/res/hibernate-distribution.cfg.xml</value>
            <value>classpath:/conf/hibernate.cfg.xml</value>
            <value>classpath:com/isoftstone/pcis/sys/res/hibernate-riskunit.cfg.xml</value>
            -->
        </list>
    </property>
    <property name="hibernateProperties">
      <props>
          <prop key="show_sql">${SHOW_SQL_ONOFF}</prop>
          <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9iDialect</prop>
          <!-- <prop key="hibernate.dialect">org.hibernate.dialect.DB2Dialect</prop>-->
      </props>
    </property>
  </bean>








  <!-- 配置事务代理,注入事务管理transactionManager,由Spring来代理事务,设置事务属性 -->
   <bean id="transactionManager"
      class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      <property name="sessionFactory">
        <ref local="sessionFactory" />
      </property>
   </bean>
   <!-- 配置事务代理Service,先将Dao注入到Service,再将Service注入给事务代理 -->
    <bean id="transactionProxy" abstract="true"
    class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
     <property name="transactionManager">
       <ref bean="transactionManager"/>
     </property>
     <property name="transactionAttributes">
       <props>
          <prop key="*">PROPAGATION_REQUIRED</prop>
       </props>
     </property>
    </bean>
<!-- 修改到各自定义配置文件里
    <bean id="demoService" parent="transactionProxy">
     <property name="target">
      <ref bean="demoServiceTarget"/>
     </property>
   </bean>
   <bean id="demoServiceTarget" class="com.isoftstone.pcis.demo.service.DemoService">
        <property name="commonDao">
         <ref bean="commonDao"/>
        </property>
    </bean>
 -->


</beans>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值