zoukankan      html  css  js  c++  java
  • [原创]Dubbo配置(Spring4+Hiberante4+Druid)

    如果dubbo使用注解,并且spring也使用注解,如使用事务,则dubbo加过注解的类无法发布。

    <?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:tx="http://www.springframework.org/schema/tx"
        xmlns:aop="http://www.springframework.org/schema/aop"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/tx  
         http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
         http://www.springframework.org/schema/aop 
         http://www.springframework.org/schema/aop/spring-aop-2.0.xsd 
         ">
    
        <!-- 配置数据源 -->
        <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
            destroy-method="close">
            <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
            <property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:ORCL" />
            <property name="username" value="test1" />
            <property name="password" value="123456" />
            <property name="filters" value="wall" />
            <property name="initialSize" value="2" />
            <property name="minIdle" value="2" />
            <property name="maxActive" value="200" />
            <property name="maxWait" value="60000" />
            <property name="minEvictableIdleTimeMillis" value="300000" />
            <property name="validationQuery" value="select 1 from dual" />
            <property name="testWhileIdle" value="true" />
            <property name="testOnBorrow" value="false" />
            <property name="testOnReturn" value="false" />
            <property name="timeBetweenEvictionRunsMillis" value="60000" />
            <property name="poolPreparedStatements" value="true" />
            <property name="maxOpenPreparedStatements" value="100" />
        </bean>
    
        <!-- 配置hibernate SessionFactory -->
        <bean id="sessionFactory"
            class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
            <property name="dataSource" ref="dataSource" />
            <property name="hibernateProperties">
                <props>
                    <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
                    <prop key="hibernate.show_sql">true</prop>
                    <prop key="hiberante.format_sql">true</prop>
                    <prop key="hibernate.autoReconnect">true</prop>
                </props>
            </property>
    
            <!-- 扫描hibernate的注解 -->
            <property name="packagesToScan" value="com.br.model" />
        </bean>
    
        <!-- 事务管理器 -->
        <bean id="transactionManager"
            class="org.springframework.orm.hibernate4.HibernateTransactionManager">
            <property name="sessionFactory" ref="sessionFactory" />
        </bean>
    
        <!--启动注解用注解来管理事务 -->
        <tx:annotation-driven transaction-manager="transactionManager" />
    </beans>
  • 相关阅读:
    20169207 2016-2017-2 《移动平台应用开发实践》第五周学习总结
    20169212 2016-2017-2《网络攻防实践》第八周学习总结
    20169212 2016-2017-2 《网络攻防实践》第七周学习总结
    20169212 2016-2017-2 《网络攻防实践》第六周学习总结
    20169212 2016-2017-2 《网络攻防实践》第五周学习总结
    20169212 2016-2017-2 《网络攻防实践》第四周学习总结
    20169212 2016-2017-2 《网络攻防实践》第三周学习总结
    20169212 2016-2017-2 《网络攻防实践》第二周学习总结
    20169212《网络攻防实践》第一周学习总结
    20169212《Linux内核原理与分析》课程总结
  • 原文地址:https://www.cnblogs.com/xiangboren/p/4250750.html
Copyright © 2011-2022 走看看