如何检查我的事务方法是否真的支持事务? [英] How to check if my transactional methods really support transactions?

查看:165
本文介绍了如何检查我的事务方法是否真的支持事务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Spring 3.0,我有一组这样的方法:

I'm using Spring 3.0, and I have a set of methods like this:

@Transactional (value = "authTransactionManager")
public void remove(User user) {
    ...
}

我使用2个不同的事务管理器并在上面的示例中指定必要的管理器( authTransactionManager )。

I use 2 different transaction managers and specify necessary manager (authTransactionManager in example above).

我很好奇如果我指定不存在的经理会发生什么。我期望编译异常或运行时异常,但一切正常。这就是为什么我对我的方法中支持的任何交易都有疑问。

I was curious what would happen if I specify nonexistent manager. I expected compile exception or runtime exception, but everything worked fine. That's why I have doubts about any transactions were ever supported in my methods.

我该如何测试? (也许,春天是如此聪明,当不存在的经理指定并且我的所有怀疑都没有根据时使用任何可用的经理?)

How can I test it? (maybe, spring is so smart that uses any available manager when nonexistent manager specified and all my doubts are unfounded?)

推荐答案

你可以打开调试级别的日志记录,这通常是我在调试这些事务问题时所做的事情!

You could turn on debug-level logging, this is generally what I do when debugging these kind of transaction problems!

Spring非常适合记录事务。

Spring is quite good about logging transactions.

这篇关于如何检查我的事务方法是否真的支持事务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆