• [原创]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>
  • 相关阅读:
    正则表达式常用收集
    IIS 部署nodejs
    借助svn进行半自动多台服务器上线部署
    快速开发window服务器程序
    sql server 存储过程解密
    EF 剥坑
    测试常规需要测试的东西
    html5本次存储几种方式
    log4net 写日志配置
    js 获取定位信息
  • 原文地址:https://www.cnblogs.com/xiangboren/p/4250750.html
Copyright © 2020-2023  润新知