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

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

问题描述

我使用的是 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.

我该如何测试?(也许,spring 非常聪明,当指定了不存在的管理器并且我所有的怀疑都没有根据时,它会使用任何可用的管理器?)

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天全站免登陆