带有Spring的EJB3 [英] EJB3 with Spring

查看:106
本文介绍了带有Spring的EJB3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经明白,如果我在Spring上下文中使用EJB,我会获得所有相同的好处,就像我在纯EJB3环境中使用它一样,这是真的吗?我用google搜索但无法找到明确,明确的答案。

I have understood that if I use EJB in Spring context, I get all the same benefits as if I was using it in "pure" EJB3 environment, is this true? I have googled but can't find a definitive, clear answer.

例如,假设我有一个会话bean来更新数据库中的某些表,它会抛出一个系统异常。在纯EJB3环境中,事务将回滚。如果我使用Spring @Autowire这个bean,那么Spring会像EJB3容器一样处理事务处理吗?或者是什么?它可能需要一些特定的配置还是完全自动?

For example, let's say I have a session bean that updates some tables in the database and it throws a System Exception. In "pure" EJB3 environment the transaction is rolled back. What if I for example @Autowire this bean using Spring, does Spring take care of the transaction handling same way as does the EJB3 container? Or what? Does it maybe require some specific configuration or is it fully "automatic"?

推荐答案

我的文章链接得到了很好的答案,从那些我编译了我的理解是的,会话bean以相同的方式工作,无论它们是否与Spring一起使用,只要bean在Spring上下文中定义为< jee: JNDI的查找> 。还找到了一篇很好的,简单的文章: http:// java。 dzone.com/articles/ejb-30-and-spring-25

I got very good answers with links to articles, and from those I compiled my understanding that yes, the session beans work the same way regardless of if they are used with Spring or without, as long as the beans are defined in the Spring context with <jee:jndi-lookup>. Also found a good, simple article about this: http://java.dzone.com/articles/ejb-30-and-spring-25

然而我不能接受一个答案,因为对我来说他们都是平等的很好,但没有一个完全在点:)可能是我的问题不够明确,开始...

However I can't accept just one answer because to me they are all equally good, but none of them exactly in point :) Could be that my question was not clear enough to start with...

(有人建议我发布为回答我自己的问题)

(It was suggested that I post this as an answer to my own question)

这篇关于带有Spring的EJB3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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