Multiple projects using a single "properties" file

Asked

Viewed 257 times

2

I have a product that is distributed in several independent MAVEN WEB projects that access a single MYSQL base. I decided to divide it into several projects so that each module stays on a different server, dividing the load. And also because they are modules with different purposes and it made no sense to deliver everything in a single package.

It turns out that these modules have some common functionalities and I created a library with common classes, so that all projects use this library.

Similarly, each module has its own *.properties. file I would like to unify these files into a single *.properties file, so that all modules could access it, facilitating changes at runtime. I thought about putting it in this library, but I would continue with the same problem, because each project has its own JAR of this library, besides, it would be necessary to extract the JAR, change the *.properties and compress it again, which makes the procedure impossible.

There is also the possibility of placing all these keys in a table in the database, since all modules access it.

Is there any more elegant solution to this situation?

1 answer

0


The basic solution is to put the configuration in databases and load the data at the startup of each application.

Another possibility is to set a network directory and read its properties file. All machines (servers) would have to see this directory, which can be mapped to facilitate changes.

A third option is to provide the settings via webservice and a "central" server that each application queries during startup.

To update the settings at "run time", there could be a timer to reload them in time intervals or even a specific functionality for it (a "reload" button somewhere). This depends on many of the changing requirements, that is, whether there may be user interaction and the frequency of changes.

As for the jar of this library, unfortunately there is no magic. Jar must be distributed in each application, with or without the properties. If there are multiple applications on the same server, a single jar can be imported into classpath through a configuration on your application server. This would avoid duplicating the jar on the same machine.

If this jar is frequently updated, its update could be automated via scripts that check a location on the network and update directly the libs of the published systems. However, it will probably be necessary to include the restart of applications in this script. I usually think it is an exaggeration. No configuration module should change that much.

Anyway, it was some ideas based on abstract requirements. If there are any more specific details or requirements about your problem, edit your question to reflect this.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.