We have two different resources of data xml and a database. Data from there is used to configure our system. We use java se ( version 7).
In the code we want to be able and access this configuration data ( independently of where it is stored) using something like:
Configuration.getInstance().getString(<HERE we can to use a constant name>);
Any ideas of how we can implement some kind of layer in between to be able to access it like above ( or a similair way).
Is there articles about this?
I am looking for a system wide configuration. How can I load data from a database using Properties?
You don't - you would use JDBC to connect to the database when your app starts and select the properties and values from a database table. Then you could iterate the result set that is returned and load the values into a Properties instance if you like.
Of course the chicken and egg problem is that your app need a minmal set of properties to know how to connect to the database. Those properties could be passed on the command line to make that part 'system-wide'.
The whole idea begs the question of whether you really want your application dependent on the availability of the database in order to even run. If the app needs that database for proper operation of other functionality then that isn't a problem.
Again, everyone would be better able to help if you gave an actual example of the types of configuration properties you are talking about.