Grails: One Database and more than one application

风格不统一 提交于 2019-12-04 12:41:12

You could run into race/locking conditions but I've seen this done on many occasions. My only suggestion is that you not maintain separate domain classes. Put common domain classes in a plugin and install said plugin in both applications.

Another common approach I've seen that mimics your approach is deploying a customer facing app separate from the admin/cms. Both talk to the same database, they're just running in different tomcat instances.

You can create a separate Gradle application which use GORM depenancy which only contains common domain classes. Create those classes (POJO) into src/main/groovy/bla/xyz, annotate them with

grails.gorm.annotation.Entity

This will make GORM identify your POJO as domain classes.

Build this application, publish it and use that as your dependancy into your other Grails application.

Before going all out, do try this with one single POJO class. Publish it into your local m2 repo and use it as dependancy into your grails application, check it out.

Hope this will help

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