Having a little time up my sleeve, and a need to be off my feet for as much as possible… wait, did I mention that? Somewhere in the last six weeks I’ve done something undefined to my feet, which are painfully sore to walk on. I think that I managed to sprain one or more of the muscles that usually wiggle my toes, and as a result walking has felt like I’ve had stones in my shoes. Since I had a few unexpected extra days off, I elected to sit on my butt as much as possible and bang away at a little project that I’ve had hanging around for ages: PropertySource, which is a simple abstraction for finding “properties”. The code and README are there in GitHub, and there’s pointers on use from the README.
I’ve had two motivations for this: first, defining key/value properties can be done in a number of different ways, and there’s little consistency across projects in how or where that will be done. By wrapping this up in an abstraction, then it becomes much easier to not have to think about how or where the properties are defined, while at the same way providing an easy way to have a hierarchy of default and override properties.
Second, I’ve become interested in the use of things like Consul and etcd as distributed dictionaries for configuration, and wanted to put together a framework into which I can easily integrate using these as property sources as well, while hiding any complexity from the user.
If you use this, please let me know how you find it, and never hesitate to suggest extensions or modifications. I do intend to keep fiddling with this, first by adding support for different distributed key/value stores, and secondly by making it simple to specify the order of hierarchy when trying to resolve a property from a variety of sources.
And as an aside… my mind is a sieve at the moment, so I’m awfully glad that I documented the process I came up with for doing Maven releases with Git!