Show HN: Externalized Properties, a modern Java configuration library
Externalized Properties is powerful configuration library which supports resolution of properties from external sources such as files, databases, git repositories, and any custom sources
(
7 comments
| on HN
)
The goal of this library is to make it easy for applications to implement configuration best practices by providing easy-to-use APIs as well as providing the flexibility to choose where to store their configurations/properties.
Externalized Properties takes full advantage of Java's Dynamic Proxies.
Why Dynamic Proxies?
* Dependency Injection Friendly
Since Externalized Properties works with interfaces, it makes it easy to integrate with dependency injection (DI) frameworks. it's as simple as building ExternalizedProperties, initializing a dynamic proxy from an interface, and registering the proxy interface to your chosen DI framework.
* Testing Friendly
Another side-effect of being dependency injection friendly is that it also makes it easy to mock/stub out configurations/properties on unit tests. It's as simple as creating a stub implementation of the proxy interface or using mocking frameworks to mock the proxy interface.
By using ExternalizedProperties instead of direct System.getenv() you get other useful features such as automatic conversions, variable expansion, and processing (e.g. automatic decryption/automatic base64 decode, etc)
See benchmarks here: https://github.com/joel-jeremy/java-config-library-benchmark...
Aside from the performance, the strongest reason to use this config library I would say is how it makes testing easier and how easy it is to integrate with your dependency injection frameworks of choise.