Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

Warning

It's not possible to define spring.profiles.active property in openhub.properties file. But there are another ways how to tell Spring which profiles should be active.

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.

...

Tip

@Value vs @ConfigurableValue:

  • it's preferable to use @ConfigurableValue because it has two underlying advantages:
    • everytime you call getValue() you get up-to-date value (@Value is processed only once during post-processing phase). If you have configuration parameter in database then you can change behavior on the fly.
    • full use of Spring Boot externalized configuration model because properties are getting via Enviroment interface.

Note: Configuration values are cached by Cache, see Hazelcast and "config_params" data structure. In other words you should clear the cache to get new value when you change it.


Tip

There can be null/empty parameter value (that is optional) and it can be problem to convert null/empty value to target data type. For example:

Code Block
@ConfigurableValue(key = "ohf.asynch.externalCall.skipUriPattern")
private ConfigurationItem<Pattern> skipOperationUriList;

If parameter ohf.asynch.externalCall.skipUriPattern is empty then it ends with the following expcetion: java.lang.IllegalArgumentException: Cannot convert value [] from source type [String] to target type [Pattern]

In these scenarious is better to use String as target data type and compile Pattern by yourselve.

Code Block
@ConfigurableValue(key = "ohf.asynch.externalCall.skipUriPattern")
private ConfigurationItem<String> skipOperationUriList;


...