Java EE architecture with Play Framework

2019-03-30 01:17发布

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.

2条回答
男人必须洒脱
2楼-- · 2019-03-30 02:10

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

查看更多
啃猪蹄的小仙女
3楼-- · 2019-03-30 02:18

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 :-)

查看更多
登录 后发表回答