Package io.microsphere.spring.boot.env
Class PropertySourceLoaders
java.lang.Object
io.microsphere.spring.boot.env.PropertySourceLoaders
- All Implemented Interfaces:
org.springframework.boot.env.PropertySourceLoader
public class PropertySourceLoaders
extends 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
-
Constructor Summary
ConstructorsConstructorDescriptionPropertySourceLoaders(ClassLoader classLoader) PropertySourceLoaders(org.springframework.core.io.ResourceLoader resourceLoader) -
Method Summary
Modifier and TypeMethodDescriptionString[]List<org.springframework.core.env.PropertySource<?>>org.springframework.core.env.PropertySource<?>loadAsOriginTracked(String name, String location) Load thePropertySourceas an instance ofPropertySourcewithOriginLookuporg.springframework.core.env.PropertySource<?>reloadAsOriginTracked(org.springframework.core.env.PropertySource<?> propertySource) Reload thePropertySourceas an instance ofPropertySourcewithOriginLookup
-
Constructor Details
-
PropertySourceLoaders
public PropertySourceLoaders() -
PropertySourceLoaders
-
PropertySourceLoaders
public PropertySourceLoaders(org.springframework.core.io.ResourceLoader resourceLoader)
-
-
Method Details
-
getFileExtensions
- Specified by:
getFileExtensionsin interfaceorg.springframework.boot.env.PropertySourceLoader
-
load
public List<org.springframework.core.env.PropertySource<?>> load(String name, org.springframework.core.io.Resource resource) throws IOException - Specified by:
loadin interfaceorg.springframework.boot.env.PropertySourceLoader- Throws:
IOException
-
reloadAsOriginTracked
public org.springframework.core.env.PropertySource<?> reloadAsOriginTracked(org.springframework.core.env.PropertySource<?> propertySource) throws IOException Reload thePropertySourceas an instance ofPropertySourcewithOriginLookup- Parameters:
propertySource-PropertySource- Returns:
- an instance of
PropertySourcewithOriginLookup - Throws:
IOException
-
loadAsOriginTracked
public org.springframework.core.env.PropertySource<?> loadAsOriginTracked(String name, String location) throws IOException Load thePropertySourceas an instance ofPropertySourcewithOriginLookup- Parameters:
name- the name ofPropertySourcelocation- the location ofResourceforPropertySource- Returns:
- an instance of
PropertySourcewithOriginLookup - Throws:
IOException
-