简体   繁体   English

在其他Java应用程序中使用我的Play框架模型类

[英]Using my play framework model classes in an other java application

i want to create a project, which contains a play 2 Java application and a plain Java Application for the administrator. 我想创建一个项目,其中包含2个Java应用程序和一个供管理员使用的普通Java应用程序。 In the play app i'm using the ebean orm (play.db.ebean) and i would like to use the same model classes in my Java app. 在play应用程序中,我正在使用ebean orm(play.db.ebean),并且我想在Java应用程序中使用相同的模型类。 Is it possible? 可能吗? When I want to use them, i get this Exception: "Caused by: java.lang.RuntimeException: There is no started application" 当我要使用它们时,出现以下异常:“由:java.lang.RuntimeException引起:没有启动的应用程序”

In order to use ebean outside of play, you have to start the ebean agent 为了在游戏之外使用ebean,您必须启动ebean代理

AgentLoader.loadAgentFromClasspath("avaje-ebeanorm-agent","debug=1;packages=org.yourclass.data.models.**")

and connect to a server as configured programmatically or through an ebean.properties file in much the same way you do in the play framework application.conf file. 并以编程方式配置的服务器或通过ebean.properties文件连接到服务器,其方式与播放框架application.conf文件中的方式大致相同。

This page gives more details and should get you there. 该页面提供了更多详细信息,应该可以使您到达那里。

Ebean ORM Quick start Ebean ORM快速入门

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

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