Skip to content

Add a ValueProvider


Implementing Liquibase extensions requires an understanding of Java. You will be creating classes, overriding methods, and working with inheritance hierarchies.

Project Setup

If you have not already created a repository to hold your code, see Your First Extension in the Getting Started guide.


When adding support for a new precondition, the interface you are going to implement is liquibase.configuration.ConfigurationValueProvider.

ConfigurationValueProvider should be thread-safe.


There is a liquibase.configuration.AbstractMapConfigurationValueProvider base class you can use which limits the number of methods you must implement.

If your data source cannot be loaded into a java.util.Map as AbstractMapConfigurationValueProvider requires, liquibase.configuration.AbstractConfigurationValueProvider does not require that implementation while still being easier than implementing ConfigurationValueProvider directly. you must implement.

API Documentation

A complete description of the API, including what methods must be implemented and how is available on the liquibase.configuration.ConfigurationValueProvider API page.

Example Code

package com.example.configuration;

import liquibase.configuration.AbstractMapConfigurationValueProvider;

import java.util.HashMap;
import java.util.Map;

public class ExampleValueProvider extends AbstractMapConfigurationValueProvider {

    public int getPrecedence() {
        return 200;

    protected String getSourceDescription() {
        return "Example value";

    protected Map<?, ?> getMap() {
        Map<String, Object> values = new HashMap<>();
        values.put("liquibase.url", "jdbc:my://database");
        values.put("", "my value");
        values.put("liquibase.random", new SecureRandom().nextInt());

        return values;