tenwit wrote:
Libraries designed to be used like this shouldn't be configuring themselves. They should make their configurations available to the application code that uses them. Remove the code in the libraries that creates configurations, but leave the .cfg.xml file. Make sure it's in a different package in each jar. Then in every application that uses any of the jars (including their respective main() methods, if they have one) can create one Configuration object, and call cof.configure() on each provided .cfg.xml file.
If the libraries don't need to configure anything unless they're being run as stand-alone applications, you don't even have to load their configurations from your main app(s). Only the mini-app inside the jar needs to do that.
What you're saying makes sense, thank you. I would appreciate a little more details.
The libraries have a HibernateUtil class like the one shown in the Hibernate reference documentation. That class has a static initializer block which creates the session factory, and a static getSessionFactory() method which the libraries use. What should I do instead? In other wods, how would the HibernateUtil class in the reference documentation be re-written for a library?
Thank you,
Yoav