Interface BroadleafSharedOverrideProfileAwarePropertySource

All Known Implementing Classes:
DefaultRuntimeEnvironmentProfileAwarePropertySource

public interface BroadleafSharedOverrideProfileAwarePropertySource

Holder for a folder of properties resources comprised of something like the following on the classpath:

  • classpath:/runtime-properties/
    • common.properties
    • common-shared.properties
    • [profile].properties
    • [profile]-shared.properties

Where the [profile] is a key that is resolved from the current Spring profile. Given that set of properties, they get ordered in the following way, where later files are applied after earlier ones and thus take precedence:

  • classpath:/runtime-properties/
    1. common-shared.properties
    2. common.properties
    3. [profile]-shared.properties
    4. [profile].properties

Note that this is largely created to support existing Broadleaf implementations for versions older than 5.2. Assuming that you are on Spring Boot, you should look to use application.properties variants from the Spring Boot documentation

There is generally only a single one of these sources registered in the application, the DefaultRuntimeEnvironmentProfileAwarePropertySource. If multiple of them are registered, they are ordered based on #getOrder() and all properties are added to the Environment prior to moving to the next BroadleafSharedOverrideProfileAwarePropertySource. To register your own version (again, not necessarily recommended) add this as an entry in a META-INF/spring.factories file:

 org.broadleafcommerce.common.config.BroadleafSharedOverrideProfileAwarePropertySource=org.broadleafcommerce.common.config.SomeCustomizedProfileAwarePropertySource
 

Properties registered via this BroadleafSharedOverrideProfileAwarePropertySource is functionally equivalent to registering them via PropertySource and have the same ordering semantics as "@PropertySource annotations on your @Configuration classes. An important distinction is that these sources have a higher priority than any PropertySource annotations on @Configuration classes.

These are guaranteed to take a higher precedence (and thus override) properties registered via FrameworkCommonClasspathPropertySource

Since:
5.2
Author:
Phillip Verheyden (phillipuniverse)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    The folder on the classpath that contains a common.properties file.
  • Field Details

  • Method Details

    • getClasspathFolder

      String getClasspathFolder()
      The folder on the classpath that contains a common.properties file. Note that this cannot be prefixed with "classpath:" or any of those varieties since this drives the creation of an ClassPathResource already based on this location.