Using JNDI for distributed configuration

We learn how to perform distributed configuration as part of our Java-based deployment. We have several applications, and it makes sense to centralize the application configuration. JNDI seems to be the standard choice, perhaps backtracking to something like ApacheDS (so we can also store non-Java configurations). Here are some of the things I've reviewed. Has anyone tried something like this? Any recommendations ?:

Distributed

This will be for multiple applications on multiple computers, some of the applications will be clustered. The directory server should also be perfectly grouped.

Lightweight

JNDI is slightly different from J2EE. Anyone uses an alternative distributed configuration mechanism. Applications themselves are generally relatively lightweight rather than full-fledged Java EE applications (it is disputable whether Java EE should still be considered a heavyweight, and the requirements are certainly heavyweight).

Backup support

Often the same configuration applies to multiple applications (for example, multiple applications can connect to the same database). On the other hand, some applications may need a specific configuration. It is sometimes difficult to know in advance whether the application will use the "global" configuration or something specific, so it would be useful to first find the application / host configuration and then backtrack. I think of a structure something like this:

/ global / host / application / instance or / global / application / host / instance:

So, start by checking if there is any configuration specific to this application instance on this host, and then check if there is any configuration specific to this application for this host, and then check if there is anything specific for this application, then try the global settings. Are there any recommendations for this kind of thing?

Live configuration changes

Spring allows you to customize with jee: jndi-lookup, and you can not cache the value, which means that it scans every request. I'm not sure what makes sense for configuration values โ€‹โ€‹of type "String". It also does not use the NamingListener method to detect changes in DS. It would be nice to be able to update the value on the directory server and transfer this change to all applications that use it.

Other considerations

  • Manage various environments
  • Adding configuration to the source control so that it can apply change management to it
  • Manage different versions
  • Rollback
+6
java configuration distributed jndi
source share
1 answer

Have you considered using a database to store application configuration? Apache Commons has a DatabaseConfiguration class that exposes your table as an instance of java.util.Properties (see http://commons.apache.org/configuration/apidocs/org/apache/commons/configuration/DatabaseConfiguration.html ).

+1
source share

All Articles