Interface PropertySourceLoader

All Known Implementing Classes:
PropertiesPropertySourceLoader, YamlPropertySourceLoader

public interface PropertySourceLoader
Strategy interface located through SpringFactoriesLoader and used to load a PropertySource.
Since:
1.0.0
Author:
Dave Syer, Phillip Webb
  • Method Details

    • getFileExtensions

      String[] getFileExtensions()
      Returns the file extensions that the loader supports (excluding the '.').
      Returns:
      the file extensions
    • load

      List<PropertySource<?>> load(String name, Resource resource) throws IOException
      Load the resource into one or more property sources. Implementations may either return a list containing a single source, or in the case of a multi-document format such as yaml a source for each document in the resource.
      Parameters:
      name - the root name of the property source. If multiple documents are loaded an additional suffix should be added to the name for each source loaded.
      resource - the resource to load
      Returns:
      a list property sources
      Throws:
      IOException - if the source cannot be loaded
    • load

      default List<PropertySource<?>> load(String name, Resource resource, @Nullable Charset encoding) throws IOException
      Load the resource into one or more property sources. Implementations may either return a list containing a single source, or in the case of a multi-document format such as yaml a source for each document in the resource.
      Parameters:
      name - the root name of the property source. If multiple documents are loaded an additional suffix should be added to the name for each source loaded.
      resource - the resource to load
      encoding - encoding of the resource
      Returns:
      a list property sources
      Throws:
      IOException - if the source cannot be loaded
      Since:
      4.1.0