External configuration model

OpenHub framework extends Spring Boot externalized configuration model (version 1.4.3.RELEASE) - bold items represent custom extension in OpenHub framework:

  1. Devtools global settings properties on your home directory (~/.spring-boot-devtools.properties when devtools is active).
  2. @TestPropertySource annotations on your tests.
  3. @SpringBootTest#properties annotation attribute on your tests.
  4. Command line arguments.
  5. Properties from SPRING_APPLICATION_JSON (inline JSON embedded in an environment variable or system property)
  6. ServletConfig init parameters.
  7. ServletContext init parameters.
  8. JNDI attributes from java:comp/env.
  9. Java System properties (System.getProperties()).
  10. OS environment variables.
  11. A RandomValuePropertySource that only has properties in random.*.
  12. Project specific configuration file "openhub.properties"
  13. Profile-specific application properties outside of your packaged jar (application-{profile}.properties and YAML variants)
  14. Profile-specific application properties packaged inside your jar (application-{profile}.properties and YAML variants)
  15. Application properties outside of your packaged jar (application.properties and YAML variants).
  16. Application properties packaged inside your jar (application.properties and YAML variants).
  17. @PropertySource annotations on your @Configuration classes.
  18. Default properties (specified using SpringApplication.setDefaultProperties).
  19. Default properties from database

Project specific configuration file

There is specific properties file openhub.properties that overrides all other property files. 

Use this file if you need to set specific project configuration and override default values.

Default properties from database

Storing properties

Properties are stored in the table configuration in DB. See Data model for more details about columns of this table.

New properties are inserted via SQL scripts as defined in application*.properties files:

Use db_init-configuration.sql or db_init-configuration-h2.sql if you need to add specific features (here H2 features).

Example from db_init-configuration.sql:

Getting properties

Properties defined in database have the lowest priority in Spring Boot externalized configuration model. Therefore these properties represent default values.

All property names are defined in org.openhubframework.openhub.api.configuration.CoreProps

Use @ConfigurableValue and ConfigurationItem for defining wrapper for getting (up-to-date) parameter values:

ConfigurationItem offers simple API for getting final parameter value:

  • getValue()
  • getValue(defaultValue)


Implementation classes are in the package org.openhubframework.openhub.core.configuration:

  • DbPropertySource - database property source
  • DbExternalPropertiesAutoConfiguration - adds DbPropertySource
  • DbConfigurationParam - entity represents one configuration parameter in database
  • Conversion to target data type uses Spring conversion model via org.springframework.core.convert.ConversionService