We have multiple web apps on our container (Tomcat) that don't interact with each other but they share the same data model. Some basic data access operations are used in multiple web apps, and of course we don't want the same code duplicated between multiple webapps.
For this case is it better to build a library to provide the common functions or to expose the functions as a web service?
With the library the user would have to provide the data source to access the database while the web service would be self-contained plus have its own logging.
My quesion is similar to this SO question but performance isn't a concern - I think working with a web service on the same container will more than meet our needs. I'm interested to know if there's a standard way to approach this problem and if one way is better than the other - I'm sure I haven't considered all the factors.
Thank you.