I need to figure out a way to share domain objects between a grails installation and non-grails installation.
Essentially, I have a liferay deployment, and I have a series of REST services deployed as a war. The liferay deployment manages the front-end and portlet deployment, but it very much needs access to domain objects and services in the REST war. If I just include the rest war as a dependency, I don't get live grails objects with .save()
, .list()
, etc.
What's the best way to structure my project such that I can share common dependencies? Ideally I could just run my liferay deployment through grails, but I'm not sure开发者_Go百科 how the URL mappings work out.
What's the best practice here?
That will be a hard one. Domain methods like save()
or list()
are added to the domain classes by the Grails Hibernate plugin by utilizing groovy metaprogramming during starting up the application. So if you just pull out domain class code, this step will not be executed.
Just as an idea: you might encapsulate the required functionality of these methods into AST transformations. When doing so, they are added at compile time and not at runtime.
精彩评论