[原创]Dubbo配置(Spring4+Hiberante4+Druid)
2024-09-01 00:45:10
如果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>
最新文章
- Tomcat中JVM内存溢出及合理配置及maxThreads如何配置(转)
- 22中编程语言的HelloWorld
- ThinkPHP 3.2.3 简单后台模块开发(一)常用配置
- Windows下Faster-RCNN的使用
- iOS改变NavigationBar的返回键和标题颜色、大小
- Swift学习--常量.变量.数据类型的使用(一)
- C语言 指针与字符串
- NodeJS异常处理uncaughtException篇
- codevs 4919 线段树练习4
- 字符串string
- uva 12549 最大流
- 使用ckplayer搭建rtmp视频直播应用
- Linux Kernel ‘mp_get_count()’函数本地信息泄露漏洞
- today reading notes
- N 组连续子串最大和
- 深入理解linux网络技术-P179
- 《AutoCAD Civil 3D .NET二次开发》勘误2
- 阿里云ECS相关
- Beta冲刺 4
- TCP/IP 笔记 - 地址解析协议