You want to manage your applications configuration properties transparently to your applications classes.
Create an aspect that loads, supplies, monitors, and stores your applications properties.
Java application properties are traditionally loaded from and managed
by a singleton class. An example of this is the
System.getProperty() method, which returns a property supplied to the
application from the command line with the -D
Unfortunately, singletons tend to be a brittle solution resulting in many areas of your application depending on the interface to the singleton. If the singleton’s interface were to change, it is likely that the many dependent areas of your application would have to change to incorporate the new interface. This is the sort of cross-cutting concern that aspects can solve.
In traditional approaches to property management, the singleton property manager is a passive participant in your application and responds to requests for property information from the various parts of your application. The property manager doesn’t have any knowledge of what is done with the property information it provides, or where it goes, and is dependent on notifications when any property is updated.
With an aspect-oriented approach to system properties, the perspective is switched around. The mechanisms provided by AspectJ allow you to design your property manager so it will actively apply the properties to those areas ...