类 PropertySourcesLoader
- java.lang.Object
- org.springframework.boot.env.PropertySourcesLoader
public class PropertySourcesLoader extends Object
Utility that can be used toMutablePropertySources
usingPropertySourceLoader
s.
构造器概要
构造器 构造器 说明 PropertySourcesLoader()
Create a newPropertySourceLoader
instance backed by a newMutablePropertySources
.PropertySourcesLoader(org.springframework.core.env.MutablePropertySources propertySources)
Create a newPropertySourceLoader
instance backed by the specifiedMutablePropertySources
.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Set<String>
getAllFileExtensions()
Returns all file extensions that could be loaded.org.springframework.core.env.MutablePropertySources
getPropertySources()
Return theMutablePropertySources
being loaded.org.springframework.core.env.PropertySource<?>
load(org.springframework.core.io.Resource resource)
Load the specified resource (if possible) and add it as the first source.org.springframework.core.env.PropertySource<?>
load(org.springframework.core.io.Resource resource, String profile)
Load the profile-specific properties from the specified resource (if any) and add it as the first source.org.springframework.core.env.PropertySource<?>
load(org.springframework.core.io.Resource resource, String name, String profile)
Load the profile-specific properties from the specified resource (if any), give the name provided and add it as the first source.org.springframework.core.env.PropertySource<?>
load(org.springframework.core.io.Resource resource, String group, String name, String profile)
Load the profile-specific properties from the specified resource (if any), give the name provided and add it to a group of property sources identified by the group name.
构造器详细资料
PropertySourcesLoader
public PropertySourcesLoader()
Create a newPropertySourceLoader
instance backed by a newMutablePropertySources
.
PropertySourcesLoader
public PropertySourcesLoader(org.springframework.core.env.MutablePropertySources propertySources)
Create a newPropertySourceLoader
instance backed by the specifiedMutablePropertySources
.- 参数:
propertySources
- the destination property sources
方法详细资料
load
public org.springframework.core.env.PropertySource<?> load(org.springframework.core.io.Resource resource) throws IOException
Load the specified resource (if possible) and add it as the first source.- 参数:
resource
- the source resource (may benull
).- 返回:
- the loaded property source or
null
- 抛出:
IOException
- if the source cannot be loaded
load
public org.springframework.core.env.PropertySource<?> load(org.springframework.core.io.Resource resource, String profile) throws IOException
Load the profile-specific properties from the specified resource (if any) and add it as the first source.- 参数:
resource
- the source resource (may benull
).profile
- a specific profile to load ornull
to load the default.- 返回:
- the loaded property source or
null
- 抛出:
IOException
- if the source cannot be loaded
load
public org.springframework.core.env.PropertySource<?> load(org.springframework.core.io.Resource resource, String name, String profile) throws IOException
Load the profile-specific properties from the specified resource (if any), give the name provided and add it as the first source.- 参数:
resource
- the source resource (may benull
).name
- the root property name (may benull
).profile
- a specific profile to load ornull
to load the default.- 返回:
- the loaded property source or
null
- 抛出:
IOException
- if the source cannot be loaded
load
public org.springframework.core.env.PropertySource<?> load(org.springframework.core.io.Resource resource, String group, String name, String profile) throws IOException
Load the profile-specific properties from the specified resource (if any), give the name provided and add it to a group of property sources identified by the group name. Property sources are added to the end of a group, but new groups are added as the first in the chain being assembled. This means the normal sequence of calls is to first create the group for the default (null) profile, and then add specific groups afterwards (with the highest priority last). Property resolution from the resulting sources will consider all keys for a given group first and then move to the next group.- 参数:
resource
- the source resource (may benull
).group
- an identifier for the group that this source belongs toname
- the root property name (may benull
).profile
- a specific profile to load ornull
to load the default.- 返回:
- the loaded property source or
null
- 抛出:
IOException
- if the source cannot be loaded
getPropertySources
public org.springframework.core.env.MutablePropertySources getPropertySources()
Return theMutablePropertySources
being loaded.- 返回:
- the property sources
getAllFileExtensions
public Set<String> getAllFileExtensions()
Returns all file extensions that could be loaded.- 返回:
- the file extensions