Easy dynamic properties for Java apps

Applications always have tons of configurations. Hardcoding values is a bad idea and configuration files often require a service restart to be applied. We needed something better.

We needed a tool that would allow us to modify configuration values at runtime and that would also be easily to integrate throughout our codebase. Using this tool, we could easily change database connection strings, timeout parameters, polling settings or API endpoints safely and without restarting our services.

Introducing Pleo Prop

Sample class using Pleo Prop

With Pleo Prop you can easily inject Prop<X> instances into your classes. These Prop<X> give you simple access to dynamic configuration settings.

Setting it up

Set up is very simple. The current Pleo Prop offering works natively with Guice, Jackson and Archaius but can be easily extended to other dependency injection framework, JSON parsers or configuration providers.

Adding the AutoPropModule to Guice

That’s it! The AutoPropModule will scan all the provided Module instances and will create new dynamic properties based on their required Prop<X>.

No need to define a list of known properties anywhere else than in your classes’ dependencies.

Other features

You typically access a Prop's value via .get() but this is sometimes not sufficient to have a fully dynamic application. For example, you might be integrating with a third party class that expects a String as an input parameter. Changing the property’s value will not change that String.

The Prop’s value is read once and will not be read again if it changes!

This can be avoided by adding a callback on the Prop .

With a callback that re-instanciates the third party class, this is now fully dynamic

Error handling

Properties are considered non-optional. They must be present in your configuration source for the module to successfully start. Here are some sample errors that can be reported by Pleo Prop.

Pleo Prop fails fast and with clear error messages


This library is fully extensible. Right now it is built on top of Guice, Jackson and Archaius but it could easily be powered by Spring or Gson.

Get the code

The code is available on GitHub https://github.com/pleo-io/prop

The Pleo Family

Pleo is a company payment card that does your expense reports and simplifies company spending. If this type of problems and technology that excite you, we’re hiring!