Versions Compared

Key

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

...

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;


...