I’m currently in a project which already has some codebase in plain Java, we need to develop a new web application which will leverage on this plain Java code.
We already have code for database access, some business rules, etc. I really just want to use Play for the web development part and don’t want to do a whole new implementation of models using a Play approach.
What I thought when looking for a Java web framework was to find something that I could embed in the project, start a server (like Jetty or something) in my application and it would take care of the web part. But reading Play’s documentation I can only find examples on how to run Play, not how to embed it into some project.
What I want to know is: can I embed a Play application inside another application? If not, how can I use my already developed plain Java code inside a Play! project?
Thanks for your attention!
Provide your existing code as a Jar file and call it from your Play app.
If your application is too big/this can’t be done for whatever reason, create some API in your app that Play can connect to (via webservices, etc) and use it.
I would not recommend embedding Play inside, not because it can’t be done (I’m sure it can) but would be messy and it is probably a good idea to keep the different concerns (web/whatever your app does) separated for easier maintenance/upgrades.