Java EE architecture with Play Framework

♀尐吖头ヾ 提交于 2019-12-12 08:14:49

问题


Is it possible to reproduce a Java EE architecture with Play? By Java EE I mean these 4 layers: view, controller, service, model.

I know play use a better architecture only based on MVC, and I love this one, but I must use a Java EE architecture for a specific project and I'd like to use Play considering it's the best Java framework from my point of view.


回答1:


You can use spring module to integrates spring with play and use it for the service/model layers : http://www.playframework.org/modules/spring

Or you can simply create a Service layer between Controllers and Model and use some patterns by yourself (singleton, factory, ...) to wire controllers with these services




回答2:


In my current project we use a traditional Java EE app as backend for a Play application. All application logic is implemented in Stateless EJBs which is accessed over RMI.

The Play controllers use remote JNDI lookup to get stubs for the remote interfaces for our EJBs. Class defintions for model classes as well as the remote interfaces is shared between the Play app and the Java EE application running on our application server (Glassfish).

The Java EE application is built by Maven which deploys an ejb-client.jar to our central Nexus server which is also accessible for the Play runtime (enabled by creating a customized Ivy setup file).

This solution has worked fine for us so far. To speed up things and make the app scalable we use Play's asynchronous job and memcache support.

Sweet :-)



来源:https://stackoverflow.com/questions/8819137/java-ee-architecture-with-play-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!