Show HN: Externalized Properties, a modern Java configuration library
github.com
Show HN: Externalized Properties, a modern Java configuration library
1–8 of 8 posts
Re: Show HN: Externalized Properties, a modern Java configuration library
#2The 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.
Re: Show HN: Externalized Properties, a modern Java configuration library
#3Re: Show HN: Externalized Properties, a modern Java configuration library
#4Re: Show HN: Externalized Properties, a modern Java configuration library
#5Externalized Properties was inspired by the The Twelve Factor Methodology's section III. Config. 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? *…
Re: Show HN: Externalized Properties, a modern Java configuration library
#6How this compares with other libs and frameworks ?
See benchmarks here: https://github.com/joel-jeremy/java-config-library-benchmark...
Aside from the performance, the other advantage of using this config library is how it makes testing easier and how easy it is to integrate with your dependency injection frameworks of choice.
Re: Show HN: Externalized Properties, a modern Java configuration library
#7I use PKL for most of my configuration needs these days. But PKL is only a format, it doesn't say where to store the config. Could I use Externalized Properties to e.g. fetch config from some random source but have it be PKL?
public class PklResolver implements Resolver {
public Optional resolve(InvocationContext context, String propertyName) {
return getFromPklConfig(propertyName);
}
}
// Register custom resolver when building ExternalizedProperties
ExternalizedProperties externalizedProperties = ExternalizedProperties.builder()
.resolvers(new PklResolver(...))
.build();
AppProperties appProperties = externalizedProperties.initialize(AppProperties.class);
// Resolves config from PklResolver
String myConfig = appProperties.myConfig();Re: Show HN: Externalized Properties, a modern Java configuration library
#8Externalized Properties was inspired by the The Twelve Factor Methodology's section III. Config. 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? *…
Reading section III, I see it specifically calls out the value in avoiding on-disk property files and named per-environment groupings of properties as non-scalable anti-patterns. I don't know whether or not I agree with that, but I am curious why you're claiming to be inspired by that section when, by and large, the only thing that seems to align with what's described in section III is not hardcoding the property val…
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)