开发者

Can grails models be used by a standalone java app?

i'm writing code from scratch. The 2 components of the system will be a std web-site, plus a game server written in java. The shared objects between the 2 components will be the models.

What i'd like to do is create the models in grails and then have the java game-server code use these models, as well as have the grails code use them of course.

Is this possible?

I know that i can create the models in java, and then have grails use the java code (at least i think i can; haven't really used grails yet). But i want to d开发者_开发知识库o the reverse.


Yes you can. You will need the Spring Framework and the Grails Gorm standalone version. The Groovy Model Beans can be used like any other Java Bean in Java.

You can not use the dynamically created GORM methods though (you will have to call them somehow through the invokeMethod that Groovy uses). Which leads to the question if you just shouldn't use Spring + Hibernate without GORM (since it is just a Spring + Hibernate Wrapper for Groovy).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜