Class PropertySourceLoaders

  • All Implemented Interfaces:
    org.springframework.boot.env.PropertySourceLoader

    public class PropertySourceLoaders
    extends java.lang.Object
    implements org.springframework.boot.env.PropertySourceLoader
    The composite class of PropertySourceLoader with utilities features

    This class loads property sources from various file formats by delegating to individual PropertySourceLoader implementations. It supports all file extensions that are supported by the loaded factories.

    Example Usage

    
     // Create a new PropertySourceLoaders instance
     PropertySourceLoaders loaders = new PropertySourceLoaders();
    
     // Get supported file extensions
     String[] extensions = loaders.getFileExtensions();
    
     // Load property sources from a resource
     Resource resource = new ClassPathResource("application.properties");
     List<PropertySource<?>> propertySources = loaders.load("myProperties", resource);
    
     // Reload a property source with origin tracking
     PropertySource<?> trackedSource = loaders.reloadAsOriginTracked(propertySources.get(0));
     
    Since:
    1.0.0
    Author:
    Mercy
    See Also:
    PropertySourceLoader
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String[] getFileExtensions()  
      java.util.List<org.springframework.core.env.PropertySource<?>> load​(java.lang.String name, org.springframework.core.io.Resource resource)  
      org.springframework.core.env.PropertySource<?> loadAsOriginTracked​(java.lang.String name, java.lang.String location)
      Load the PropertySource as an instance of PropertySource with OriginLookup
      org.springframework.core.env.PropertySource<?> reloadAsOriginTracked​(org.springframework.core.env.PropertySource<?> propertySource)
      Reload the PropertySource as an instance of PropertySource with OriginLookup
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PropertySourceLoaders

        public PropertySourceLoaders()
      • PropertySourceLoaders

        public PropertySourceLoaders​(java.lang.ClassLoader classLoader)
      • PropertySourceLoaders

        public PropertySourceLoaders​(org.springframework.core.io.ResourceLoader resourceLoader)
    • Method Detail

      • getFileExtensions

        public java.lang.String[] getFileExtensions()
        Specified by:
        getFileExtensions in interface org.springframework.boot.env.PropertySourceLoader
      • load

        public java.util.List<org.springframework.core.env.PropertySource<?>> load​(java.lang.String name,
                                                                                   org.springframework.core.io.Resource resource)
                                                                            throws java.io.IOException
        Specified by:
        load in interface org.springframework.boot.env.PropertySourceLoader
        Throws:
        java.io.IOException
      • reloadAsOriginTracked

        public org.springframework.core.env.PropertySource<?> reloadAsOriginTracked​(org.springframework.core.env.PropertySource<?> propertySource)
                                                                             throws java.io.IOException
        Reload the PropertySource as an instance of PropertySource with OriginLookup
        Parameters:
        propertySource - PropertySource
        Returns:
        an instance of PropertySource with OriginLookup
        Throws:
        java.io.IOException
      • loadAsOriginTracked

        public org.springframework.core.env.PropertySource<?> loadAsOriginTracked​(java.lang.String name,
                                                                                  java.lang.String location)
                                                                           throws java.io.IOException
        Load the PropertySource as an instance of PropertySource with OriginLookup
        Parameters:
        name - the name of PropertySource
        location - the location of Resource for PropertySource
        Returns:
        an instance of PropertySource with OriginLookup
        Throws:
        java.io.IOException