Constretto - configuration made easy

The Constretto project is essentially about making it easier to configure your JVM-based applications. Constretto allows you to inject the runtime configuration into the running code, thus making it easy to reconfigure your application without having to redeploy. Constretto and all its subprojects is distributed under an ASF V2 license.


Add depedendency

Constretto is available from the central Sonatype OSS repository, so it is easy to add it to your project


If you're using Maven, add the following to your pom:


libraryDependencies += "org.constretto" % "constretto-core" % "2.2.3"

Add @Configuration or/and @Configure to POJO

In order to make your POJO "Constrettofied", you use the @Configuration (for fields and parameters) or @Configure (on methods, including constructors)
public class DataSourceConfiguration {

    private String myUrl;
    private String myPassword;
    private Integer version;

	// When no expression is explicitly given Constretto will use field name as key
    private String vendor;

    private String myUsername;

    public void configure(String url, @Configuration("password") String secret) {
        this.myUrl = url;
        this.myPassword = secret;

    public void setVersion(Integer version) {
        this.version = version;

    public String getUrl() {
        return myUrl;

    public String getUsername() {
        return myUsername;

    public String getPassword() {
        return myPassword;

    public String getVendor() {
        return vendor;

    public Integer getVersion() {
        return version;

Load configuration

Tell Constretto where to read configuration from by constructing a ConstrettoConfiguration object. Constretto-Core currently supports Java properties files, Encrypted Java properties files, Windows-style INI files, JSON, POJOs and System properties (automatically added when using the ConstrettoBuilder.
final ConstrettoConfiguration configuration = new ConstrettoBuilder(). // System properties are added as default
	.createPropertiesStore() // for standard Java property files 
		.done() // Multiple resources may be added
	.createEncryptedPropertiesStore(SHARED_SECRET) // for Java property files with encrypted values
	.createIniFileConfigurationStore() // For Windows-style INI files
	.createJsonConfigurationStore() // Configuration in JSON format 
	.createObjectConfigurationStore() // Configuration as POJOs

Inject configuration

Use your ConstrettoConfiguration object to inject configuration in your POJOs.
DataSourceConfiguration dataSourceConfiguration = new DataSourceConfiguration();
configuration.on(dataSourceConfiguration); // for existing objects
DataSourceConfiguration dbConfig = // Constretto constructs the pojo and injects configuration

Environment tagging support

Constretto supports storing environment-specific configuration by using tags. When using the Java property file format you can specify it using the @(tag) prefix:
	somedb.username=default username
	@production.somedb.username=username in production
	@systest.somedb.username=username in system test

Telling Constretto which tags to look up

Constretto uses a System property, or System environment property to know what tags to look up. this property is called "CONSTRETTO_TAGS" Example:
	$java MyApp -DCONSTRETTO_TAGS=tag1,tag2,tag3
	$export CONSTRETTO_TAGS=tag1,tag2,tag3
	$java Myapp

Articles in our website:

Ohio war orphans scholarship

Ohio war orphans scholarship

Since the American Civil War, there have been many scholarships available to the children of military personnel who were killed in action. These scholarships provide financial assistance to help with the cost of education. One such scholarship is the Ohio War Orphans Scholarship, which is available to the children of Ohio military personnel who were…

Dental hygienist jobs in fort Lauderdale FL, Florida

Dental hygienist jobs in fort Lauderdale FL, Florida

If you’re looking for an exciting and rewarding career in dental hygiene, you should definitely consider Fort Lauderdale, Florida. Dental hygienist jobs in Fort Lauderdale offer a great opportunity to work in a beautiful and sunny beach community. There are many different types of dental practices in Fort Lauderdale, so you can find a job…

Medical billing and coding jobs in fort worth Texas

Medical billing and coding jobs in fort worth Texas

If you’re looking for a job in the medical billing and coding field in Fort Worth, Texas, you’re in luck. There are plenty of great opportunities available in this growing field. Medical billing and coding is a vital part of the healthcare industry, and there is a growing demand for qualified professionals in this field….

How much do radiologists make in California

How much do radiologists make in California

According to the Bureau of Labor Statistics, the median annual wage for radiologists in California is $353,670. However, wages can vary depending on factors such as location, experience, and type of employer. Radiologists in California make an average salary of $411,844 per year. However, salaries can range from $267,280 to $597,760 per year, depending on…

How much does a porsche salesman make

How much does a porsche salesman make

A Porsche salesman typically earns a salary of $50,000-$100,000 per year, plus commissions and bonuses. The average commission rate for a Porsche salesman is about 10%, meaning that they earn an additional $5,000-$10,000 per car sold. The average Porsche salesman sells about 10-15 cars per month, so their total monthly income can range from $6,000-$20,000….

How much does an Uber driver make in Oklahoma city

How much does an Uber driver make in Oklahoma city

If you’re thinking about becoming an Uber driver in Oklahoma City, you might be wondering how much you could potentially earn. In this post, we’ll give you an overview of how Uber’s earnings work and how much Uber drivers in Oklahoma City make on average. According to Uber, the average driver in Oklahoma City makes…

New York school for medical and dental assistants review

New York school for medical and dental assistants review

The New York School for Medical and Dental Assistants is a great place to learn the skills you need to be a successful medical or dental assistant. The faculty is experienced and knowledgeable, and the facilities are top-notch. I highly recommend this school to anyone considering a career in the medical or dental field. The…

How much do Uber drivers make in north Carolina

How much do Uber drivers make in north Carolina

According to, the average Uber driver in North Carolina makes $13.17 per hour. According to Glassdoor, the average Uber driver in North Carolina makes $15 per hour. However, pay can vary based on factors such as location, time of day, and demand. How much does Uber drivers make in North Carolina? According to Uber,…