简体   繁体   English

如何将JavaEE后端与Play框架结合?

[英]How to combine JavaEE backend with Play framework?

I am creating a new web application where I am using JPA, EJB and all the goodnes from JavaEE. 我正在创建一个新的Web应用程序,在其中使用JPA,EJB和JavaEE的所有功能。 However, I have been doing some JSF in the past (yes the latest version) and I personally don't like that much. 但是,过去我一直在做一些JSF(是最新版本),而我个人并不那么喜欢。 So I have been introduced to Play Framework which is pretty awesome from what I have read so far. 因此,我被介绍给Play框架,到目前为止我已经读过它了。 Now I want to use the Java EE backend with the Play framework. 现在,我想将Java EE后端与Play框架一起使用。 How would you do that? 你会怎么做? In order to use EJBs etc you need a EJB container and all that is provided by servers such as Glassfish, JBoss etc and Play framework use Netty (if I am correct). 为了使用EJB等,您需要一个EJB容器,并且由Glassfish,JBoss等服务器和Play框架等服务器提供的所有容器都使用Netty(如果我正确的话)。 So how would you make these technologies talk together? 那么,您将如何使这些技术一起交流呢? Webservice (REST), RMI...? Web服务(REST),RMI ...?

And would the performance/lag be very high? 性能/滞后会很高吗? I will have both servers running on the same VPS. 我将使两个服务器都在同一VPS上运行。

If you are using Play 1.x (which I suspect that you would be since it sounds like you are looking to use Java, not Scala?), then you could use the Play Spring Module . 如果您使用的是Play 1.x(我想您应该使用Play 1.x,因为听起来好像您正在使用Java,而不是Scala?),则可以使用Play Spring Module

I have not personally used this module with Play, I have stuck with the out-of-the-box structure (which uses JPA, btw). 我还没有在Play上使用此模块,而是使用了现成的结构(使用JPA,btw)。

AFAIK, you'll have two options: AFAIK,您将有两个选择:

  1. Use an embeddable EJB container and start it in the Play 2.0 Global.onStart() . 使用可嵌入的EJB容器,然后在Play 2.0 Global.onStart()中启动它。 It exists these kinds of containers for various Java EE servers ( JBoss , Glassfish etc...) 它存在用于各种Java EE服务器( JBossGlassfish等)的这类容器。
  2. Use webservices served from your Java EE app, but it will add a new "layer", and it should be slower. 使用从Java EE应用程序提供的Web服务,但是它将添加一个新的“层”,并且速度应较慢。

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

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