Class BroadleafEnvironmentConfigurer
- Direct Known Subclasses:
BroadleafEnvironmentConfiguringApplicationListener
,BroadleafEnvironmentConfiguringPostProcessor
Created as a common class for adding property sources to the Spring Environment
.
Adds META-INF/spring.factories
entries of type FrameworkCommonClasspathPropertySource
and BroadleafSharedOverrideProfileAwarePropertySource
to the current Environment
. All property sources that this initializer adds are added as composite sources to the Environment
with
different priorities, and are added relative to each other via the AnnotationAwareOrderComparator
. The PropertySource
s are in the Environment
in the following order, all as CompositePropertySource
s:
OVERRIDE_SOURCES_NAME
- An external property file given with-Dproperty-override
PROFILE_AWARE_SOURCES_NAME
- AllBroadleafSharedOverrideProfileAwarePropertySource
entries fromMETA-INF/spring.factories
FRAMEWORK_SOURCES_NAME
- AllFrameworkCommonClasspathPropertySource
entries fromMETA-IF/spring.factories
If no Spring profile is active, this will default to "development"
and add that profile to Environment.getActiveProfiles()
in order
to maintain backwards compatibility with Broadleaf versions prior to 5.2.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
The name of the Broadleaf framework composite properties within the Environment, useful for ordering before and afterstatic final String
The name of the the property source from the command line -Dproperty-overridestatic final String
The name of the profile-aware property sourcesstatic final String
A -D argument representing a path to a file that overrides all of the other properties resolved from internal property filesstatic final String
static final String
The name of the the property source from the command line -Dproperty-shared-override -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addToEnvironment
(org.springframework.core.env.ConfigurableEnvironment environment, List<org.springframework.core.io.Resource> resources, String compositeSourceName, String addBeforeSourceName) Adds the specified resource as aPropertySource
to the given environment at the order from addBeforeResourceName.void
configure
(org.springframework.core.env.ConfigurableEnvironment environment) protected org.springframework.core.io.Resource
createClasspathResource
(String rootLocation, String propertyName, String suffix) protected String
protected List<FrameworkCommonClasspathPropertySource>
-
Field Details
-
PROPERTY_OVERRIDES_PROPERTY
A -D argument representing a path to a file that overrides all of the other properties resolved from internal property files- See Also:
-
PROPERTY_SHARED_OVERRIDES_PROPERTY
- See Also:
-
DEPRECATED_RUNTIME_ENVIRONMENT_KEY
- See Also:
-
FRAMEWORK_SOURCES_NAME
The name of the Broadleaf framework composite properties within the Environment, useful for ordering before and after- See Also:
-
PROFILE_AWARE_SOURCES_NAME
The name of the profile-aware property sources- See Also:
-
SHARED_OVERRIDE_SOURCES_NAME
The name of the the property source from the command line -Dproperty-shared-override- See Also:
-
OVERRIDE_SOURCES_NAME
The name of the the property source from the command line -Dproperty-override- See Also:
-
-
Constructor Details
-
BroadleafEnvironmentConfigurer
public BroadleafEnvironmentConfigurer()
-
-
Method Details
-
getFrameworkSources
-
getProfileAwareSources
-
configure
public void configure(org.springframework.core.env.ConfigurableEnvironment environment) -
createClasspathResource
-
addToEnvironment
protected void addToEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, List<org.springframework.core.io.Resource> resources, String compositeSourceName, String addBeforeSourceName) Adds the specified resource as a
PropertySource
to the given environment at the order from addBeforeResourceName. If the resource does not exist (meaningresource.exists() == false
) then this immediately returns addBeforeResourceNameIf addBeforeResourceName is null, the given resource will be added last via
MutablePropertySources.addLast(PropertySource)
. -
getDeprecatedDefaultProfileKey
-