001/*
002 * Copyright 2002-2020 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.test.context;
018
019import java.util.function.Supplier;
020
021/**
022 * Registry used with {@link DynamicPropertySource @DynamicPropertySource}
023 * methods so that they can add properties to the {@code Environment} that have
024 * dynamically resolved values.
025 *
026 * @author Phillip Webb
027 * @author Sam Brannen
028 * @since 5.2.5
029 * @see DynamicPropertySource
030 */
031public interface DynamicPropertyRegistry {
032
033        /**
034         * Add a {@link Supplier} for the given property name to this registry.
035         * @param name the name of the property for which the supplier should be added
036         * @param valueSupplier a supplier that will provide the property value on demand
037         */
038        void add(String name, Supplier<Object> valueSupplier);
039
040}