Class ApplicationPropertySource


  • public class ApplicationPropertySource
    extends org.springframework.core.env.EnumerablePropertySource<Deque<org.springframework.core.env.PropertySource<?>>>
    Application properties can be get as combinations of locations and names. If a location is a folder then it is concatenated with each name. For example:

    application name (from the Spring application context): WebStudio
    Spring active profiles: prod, qa
    locations: file:, file:openl.properties, file:openl/
    names: application.properties, {appName}.properties, {profile}.properties

    Then the list of resources to search is (next resource overides previous):

    1. file:application.properties
    2. file:WebStudio.properties
    3. file:prod.properties
    4. file:qa.properties
    5. file:openl.properties
    6. file:openl/application.properties
    7. file:openl/WebStudio.properties
    8. file:openl/prod.properties
    9. file:openl/qa.properties

    Default Application externalized configuration:
    Can be overridden using openl.config.name or spring.config.name properties for names.
    And openl.config.location or spring.config.location properties for folders and locations.

    1. classpath:application*-default.properties
    2. classpath:application.properties
    3. classpath:{appName}.properties
    4. classpath:config/application.properties
    5. classpath:config/{appName}.properties
    6. file:application.properties
    7. file:{appName}.properties
    8. file:conf/application.properties
    9. file:conf/{appName}.properties
    10. file:config/application.properties
    11. file:config/{appName}.properties
    12. file:${user.home}/application.properties
    13. file:${user.home}/{appName}.properties
    14. classpath:application-{profile}.properties
    15. classpath:{appName}-{profile}.properties
    16. classpath:config/application-{profile}.properties
    17. classpath:config/{appName}-{profile}.properties
    18. file:application-{profile}.properties
    19. file:{appName}-{profile}.properties
    20. file:conf/application-{profile}.properties
    21. file:config/application-{profile}.properties
    22. file:conf/{appName}-{profile}.properties
    23. file:config/{appName}-{profile}.properties
    24. file:${user.home}/application-{profile}.properties
    25. file:${user.home}/{appName}-{profile}.properties
    Author:
    Yury Molchan
    See Also:
    Spring Boot. Externalized Configuration.
    • Method Detail

      • getProperty

        public Object getProperty​(String name)
        Specified by:
        getProperty in class org.springframework.core.env.PropertySource<Deque<org.springframework.core.env.PropertySource<?>>>
      • containsProperty

        public boolean containsProperty​(String name)
        Overrides:
        containsProperty in class org.springframework.core.env.EnumerablePropertySource<Deque<org.springframework.core.env.PropertySource<?>>>
      • getPropertyNames

        public String[] getPropertyNames()
        Specified by:
        getPropertyNames in class org.springframework.core.env.EnumerablePropertySource<Deque<org.springframework.core.env.PropertySource<?>>>