码迷,mamicode.com
首页 > 编程语言 > 详细

spring数据源配置

时间:2016-06-14 13:39:35      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
   <!--系统计划任务-->
   <bean id="hibernatePropertiesFeiShuidj" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> 
        <property name="properties">
            <props>
            <!-- <prop key="hibernate.dialect">net.sf.hibernate.dialect.SQLServerDialect</prop>--> 
                   <prop key="hibernate.dialect">net.sf.hibernate.dialect.OracleDialect</prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.max_fetch_depth">1</prop>
            </props>
        </property>
    </bean>
   <bean id="dataSourceFeiShuidj" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
       <!-- 非税对接先做sqlserver测试,前置机是oracle 
         <property name="driverClassName"><value>net.sourceforge.jtds.jdbc.Driver</value></property>
        <property name="url"><value>jdbc:jtds:sqlserver://127.0.0.1:1433/xzfw_test;charset=gbk;SelectMethod=CURSOR</value></property>
        <property name="username"><value>sa</value></property>
        <property name="password"><value>sa123</value></property>-->
        <property name="driverClassName"><value>oracle.jdbc.driver.OracleDriver</value></property>
        <property name="url"><value>jdbc:oracle:thin:@59.231.52.27:1521:ORCL</value></property>
        <property name="username"><value>syfs_cs</value></property>
        <property name="password"><value>1</value></property>  
    </bean>
    <bean id="sessionFactoryFeiShuidj"    class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
        <property name="dataSource"><ref bean="dataSourceFeiShuidj" /></property>
        <property name="mappingDirectoryLocations">
            <list>
                <value>WEB-INF/classes/feishuidj/hbm/domain</value>
            </list>
        </property>
        <property name="hibernateProperties"><ref bean="hibernatePropertiesFeiShuidj"/></property>
    </bean>
    <bean id="hibernateTemplateFeiShuidj" class="org.springframework.orm.hibernate.HibernateTemplate">
       <property name="sessionFactory"><ref bean="sessionFactoryFeiShuidj" /></property>
    </bean>
    <!--定时调度控制对象-->
    <bean id="feishuidj" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
          <property name="triggers">
              <list>
                      <!--非税数据对接 -->
                      <ref local="feishuidjTrigger"/>
              </list>
          </property>
    </bean>
    <!-- 系统计划任务之 数据自动交换 -->
    <bean id="feishuidjTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
          <property name="jobDetail"><ref bean="feishuidjDetail"/></property>
          <property name="cronExpression"><value>1/20 * * * * ?</value></property>
    </bean>
    <bean name="feishuidjDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
          <property name="targetObject"><ref bean="feishuidjJob"/></property>
          <property name="targetMethod"><value>doFeiShuidj</value></property>
    </bean>
    <bean name="feishuidjJob" class="feishuidj.FeiShuidjJob" autowire="byName">
        <property name="hibernateTemplateFeiShuidj"><ref bean="hibernateTemplateFeiShuidj" /></property>
    </bean>    
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

        <bean name="feishuiAction" class="action.feishui.FeiShuiAction"  singleton="false" autowire="byName"></bean>

    <bean name="feiShuiService" parent="baseProxy">
        <property name="target" > <ref bean="FeiShuiServiceImpl"/> </property>
    </bean>
<bean name="FeiShuiServiceImpl" class="domain.service.impl.FeiShuiServiceImpl" autowire="byName" ></bean>
         
</beans>

 

spring数据源配置

标签:

原文地址:http://www.cnblogs.com/liusijia/p/5583461.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!