简体   繁体   English

Tomcat + CDI + JSF2,但我的交易在哪里?

[英]Tomcat + CDI + JSF2 but where's my transaction?

My company has tomcat 7 as distributed environement. 我的公司有tomcat 7作为分布式环境。 I'd like to get JSF2 and CDI working together on tomcat 7. This is possible with not a lot of surprises as described here: http://www.theserverside.com/tutorial/Working-with-CDI-and-JSF-20-on-Tomcat-7-Configuring-Weld 我想让JSF2和CDI在tomcat 7上一起工作。这可能没有很多惊喜,如下所述: http//www.theserverside.com/tutorial/Working-with-CDI-and-JSF- 20-ON-Tomcat的7 -配置-焊接

My problem is about transaction, without Java EE 3 solutions comes to me: 我的问题是关于事务,没有Java EE 3解决方案来找我:

  1. Do it by hand : em.getTransaction().begin() ... 手动完成:em.getTransaction()。begin()...
  2. Use CDI interceptor made by my self or ones like CODI http://matthiaswessendorf.wordpress.com/2010/11/20/enterprise-java-without-ejbs-but-with-cdi-and-myfaces-codi/ 使用我自己制作的CDI拦截器或像CODI那样的拦截器http://matthiaswessendorf.wordpress.com/2010/11/20/enterprise-java-without-ejbs-but-with-cdi-and-myfaces-codi/
  3. Use spring transaction but as far as I know there is a problem between JSR 299 & 330 and it needs some glue to work : http://matthiaswessendorf.wordpress.com/2010/05/06/using-cdi-scopes-with-spring-3/ 使用spring事务,但据我所知,JSR 299和330之间存在问题,需要一些胶水才能工作: http//matthiaswessendorf.wordpress.com/2010/05/06/using-cdi-scopes-with-弹簧-3 /

So where would you go if you were me? 如果你是我,你会去哪儿? CODI seems nice to me. CODI对我很好。

thx 谢谢

DeltaSpike :)虽然如果您正在寻找Apache孵化器之外的东西,CODI将运作良好。

Change to Google Guice like me : ) 像我一样改为Google Guice:)

For latest project I use JSF2 + Primefaces + Google Guice + EclipseLink 对于最新项目,我使用JSF2 + Primefaces + Google Guice + EclipseLink

This solution make code clean easy and ready to make unit test. 该解决方案使代码清洁变得容易,并且可以进行单元测试。 (with TestNG) (使用TestNG)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM