---
title: "applicationContext.xml"
author: "mintelong"
date: "2010-06-06T21:02:33Z"
tags: []
categories: ["非技术"]
slug: "applicationcontext-xml"
draft: false
lastmod: "2010-06-06T21:05:46Z"
id: 685470
url: "https://mintelong.iteye.com/blog/685470"
---

加载多个ApplicationContext.xml中的服务时报如下错误：

Pre-bound JDBC Connection found - HibernateTransactionManager does not support running within DataSourceTransactionManager if told to manage the DataSource itself. It is recommended to use a single HibernateTransactionManager for all transactions on a single DataSource, no matter whether Hibernate or JDBC access

解决方法，设置单例模式来加载配置文件~

 

 

 

 

**事务传播行为种类**

Spring在TransactionDefinition接口中规定了7种类型的事务传播行为，

它们规定了事务方法和事务方法发生嵌套调用时事务如何进行传播：

[表]()1事务传播行为类型

事务传播行为类型

说明

PROPAGATION\_REQUIRED

如果当前没有事务，就新建一个事务，如果已经存在一个事务中，加入到这个事务中。这是最常见的选择。

PROPAGATION\_SUPPORTS

支持当前事务，如果当前没有事务，就以非事务方式执行。

PROPAGATION\_MANDATORY

使用当前的事务，如果当前没有事务，就抛出异常。

PROPAGATION\_REQUIRES\_NEW

新建事务，如果当前存在事务，把当前事务挂起。

PROPAGATION\_NOT\_SUPPORTED

以非事务方式执行操作，如果当前存在事务，就把当前事务挂起。

PROPAGATION\_NEVER

以非事务方式执行，如果当前存在事务，则抛出异常。

PROPAGATION\_NESTED

如果当前存在事务，则在嵌套事务内执行。如果当前没有事务，则执行与PROPAGATION\_REQUIRED类似的操作。