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>
  • 相关阅读:
    两小时入门Docker
    Django之Model操作
    Django-channels 实现WebSocket实例
    Python项目中的单元测试
    將Python打包成 exe可执行文件
    CORS 跨域
    购物车模块
    登陆模块
    Git 基本用法
    Django ORM性能优化 和 图片验证码
  • 原文地址:https://www.cnblogs.com/xiangboren/p/4250750.html
Copyright © 2011-2022 走看看