Class TestPropertySourceUtils

java.lang.Object
org.springframework.test.context.support.TestPropertySourceUtils

public abstract class TestPropertySourceUtils extends Object
Utility methods for working with @TestPropertySource and adding test PropertySources to the Environment.

Primarily intended for use within the framework.

Since:
4.1
Author:
Sam Brannen, Anatoliy Korovin, Phillip Webb
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The name of the MapPropertySource created from inlined properties.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addInlinedPropertiesToEnvironment(org.springframework.context.ConfigurableApplicationContext context, String... inlinedProperties)
    Add the given inlined properties to the Environment of the supplied context.
    static void
    addInlinedPropertiesToEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, String... inlinedProperties)
    Add the given inlined properties (in the form of key-value pairs) to the supplied environment.
    static void
    addPropertiesFilesToEnvironment(org.springframework.context.ConfigurableApplicationContext context, String... locations)
    Add the Properties files from the given resource locations to the Environment of the supplied context.
    static void
    addPropertiesFilesToEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, org.springframework.core.io.ResourceLoader resourceLoader, String... locations)
    Add the Properties files from the given resource locations to the supplied environment.
    static void
    addPropertySourcesToEnvironment(org.springframework.context.ConfigurableApplicationContext context, List<org.springframework.core.io.support.PropertySourceDescriptor> descriptors)
    Add property sources for the given descriptors to the Environment of the supplied context.
    static void
    addPropertySourcesToEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, org.springframework.core.io.ResourceLoader resourceLoader, List<org.springframework.core.io.support.PropertySourceDescriptor> descriptors)
    Add property sources for the given descriptors to the supplied environment.
    static Map<String,Object>
    convertInlinedPropertiesToMap(String... inlinedProperties)
    Convert the supplied inlined properties (in the form of key-value pairs) into a map keyed by property name.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait