与使用EAR与WAR相比有好处吗? [英] Benefits over using an EAR vs. WAR?
问题描述
我们将JavaEE 7应用程序部署在Wildfly 8上.以前,我们已经将所有企业应用程序(WAR,多个EJB JAR文件)打包为EAR.但是,现在有了JavaEE,您就可以将EJB打包在WAR文件中(或作为WAR的WEB-INF/lib中的JAR打包),我们想知道部署EAR而不是进行WAR打包是否有任何好处.>
EAR是否提供WAR不提供的东西?当然,使用WAR可以降低包装的复杂性.部署方面有什么不同吗?EJB命名?有什么吗?
- 易于部署(仅一个软件包,而不是多个软件包).
- 某些服务器(例如Weblogic,但不是wildfly)允许整个EAR共享会话.
- 通常,EAR提供了更多的选项来配置AS.
- 用于定义配置文件
application.xml
的特殊文件夹(APP-INF).
如果您的应用程序仅包含多个WAR,那么维护多个部署可能就没那么大了.但是,请考虑使用WAR,EJB,JMS等的应用程序.管理EAR中所有这些组件之间的交互会容易得多.
您可能想阅读包装应用程序 Java EE教程的一部分.
We're deploying our JavaEE 7 application on Wildfly 8. Previously, we've packaged all of our enterprise applications (WAR, multiple EJB JAR files) as an EAR. However, with JavaEE now allowing you to package EJBs in a WAR file (or as a JAR within the WAR's WEB-INF/lib) we're wondering if there is any benefit in deploying an EAR rather than going with WAR packaging.
Does an EAR provide something that a WAR does not? It certainly reduces packaging complexity to make use of a WAR. Is there any difference in terms of deployment? EJB naming? Anything?
- Easier to deploy (only one package instead of multiples).
- Some server (example Weblogic, but not wildfly) allow shared session for an entire EAR.
- In general, EAR provide more option to configure with AS.
- Special folder (APP-INF) that let you define a config file
application.xml
.
If your application would consist only of multiple WARs then you may not find it such a big deal to maintain multiple deploy. However, consider an application which use WARs, EJBs, JMS etc. It will be a lot easier to mananage the interaction between all these components in an EAR.
You might want to read the packaging application part of the Java EE tutorial.
这篇关于与使用EAR与WAR相比有好处吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!