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 PropertySources are in the Environment
in the following order, all as CompositePropertySources:
OVERRIDE_SOURCES_NAME- An external property file given with-Dproperty-overridePROFILE_AWARE_SOURCES_NAME- AllBroadleafSharedOverrideProfileAwarePropertySourceentries fromMETA-INF/spring.factoriesFRAMEWORK_SOURCES_NAME- AllFrameworkCommonClasspathPropertySourceentries 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 Stringstatic final StringThe name of the Broadleaf framework composite properties within the Environment, useful for ordering before and afterstatic final StringThe name of the the property source from the command line -Dproperty-overridestatic final StringThe name of the profile-aware property sourcesstatic final StringA -D argument representing a path to a file that overrides all of the other properties resolved from internal property filesstatic final Stringstatic final StringThe name of the the property source from the command line -Dproperty-shared-override -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddToEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, List<org.springframework.core.io.Resource> resources, String compositeSourceName, String addBeforeSourceName) Adds the specified resource as aPropertySourceto the given environment at the order from addBeforeResourceName.voidconfigure(org.springframework.core.env.ConfigurableEnvironment environment) protected org.springframework.core.io.ResourcecreateClasspathResource(String rootLocation, String propertyName, String suffix) protected Stringprotected 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
PropertySourceto 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
-