Tomcat 7上的CDI-有意义吗? [英] CDI on Tomcat 7 - does it make sense?

查看:94
本文介绍了Tomcat 7上的CDI-有意义吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果可以选择,我将JBoss 7用于使用JSF 2和CDI的Java EE 6项目.

If I can choose, I use JBoss 7 for a Java EE 6 project using JSF 2 and CDI.

但是有时候,客户项目的环境或多或少都已设定好-因此,在一种情况下,我们仅限于Tomcat(6或7).

But sometimes, the environment for a customer's project is more or less set - so in one case we are limited to Tomcat (6 or maybe 7).

因此,我读了几篇有关在Tomcat中使用CDI(例如WELD)和JSF 2的文章,表明这样做基本上没有问题.

So, I read a couple of articles about using CDI (e.g. WELD) and JSF 2 within Tomcat, which showed that it's basically no problem doing it.

仍然,我的问题是-这有意义吗?还是servlet容器不是这种架构的正确环境?除了演示项目以外,还有没有人有使用Tomcat + CDI的经验?

Still, my question is - does it make sense? Or is a servlet container just not the right environment for such an architecture? Has anyone any experience using Tomcat+CDI for something more than a demo project?

提前谢谢!

推荐答案

好问题,首先:)

例如,将企业应用程序部署到servlet引擎是主要方案.春天,所以肯定有可能.但是您会知道,Spring是一个由API和配置文件组成的完整生态系统,而不是您简单地放在服务器上并从中获得乐趣的几个JAR.

Deploying an enterprise application to a servlet engine is the main scenario of e.g. Spring, so it is certainly possible. But you will know that Spring is a whole ecosystem of APIs and config-files rather than a few JARs that you simply put on the server and have fun with.

我在Weld& amp; Tomcat 7上的JSF,效果很好.但是,HelloWorldOnTomcat.java和面向实际客户的真实应用程序之间存在重大差异.我确定您知道这一点.

I played quite a bit with Weld & JSF on Tomcat 7, and it worked pretty good. But there is a major difference between HelloWorldOnTomcat.java and a real application for real customers. I'm sure that you are aware of this.

我要说的是,您将能够在相对较短的时间内编译出不错的设置. CDI和JSF都不会有问题. 但是然后,根据您的具体要求,您将不得不处理现成的Tomcat未涵盖的其他方面.安全性,群集,故障转移,消息传递,异步性等一些问题(以及注释中提到的事务).

I'd say that you will be able to compile a decent setup in relative short time. Neither CDI nor JSF will be problematic. But depending on your concrete requirements you then will have to deal with other aspects that are not covered by an out-of-the-box Tomcat. Security, clustering, fail-over, messaging, asynchronity to name a few concerns (And transactions, as mentioned in the comments).

如果您(或多或少)精通这些要求,而您即将进行的项目相当轻松,不应该控制下一个火星任务-我当然可以尝试一下.

If you are (more or less) proficient with such requirements and your upcoming project is rather relaxed and not supposed to control the next Mars mission - I'd certainly give it a try.

另一方面,如果您知道这些要求,我会寻找(a)Java EE应用服务器上的设置,或(b)Tomcat上的另一个堆栈.

On the other hand if you know about such requirements I'd look for (a) a setup on a Java EE app server, or (b) another stack on a Tomcat.

这篇关于Tomcat 7上的CDI-有意义吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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