I tried the OpenLiberty MP Config Sample (guide-microprofile-config), so far it works. But when analyzing it more closely, I found out that the method getProperties() in the file CustomConfigSource is called several times in repetition. This is a behavior I did not expect. In the file InventoryConfig there are variables injected statically and dynamically (by using "Provider<>"). But this code should only be called when I call a REST Service. So my question what does trigger getProperties() all the times? How can I prevent it. Actually with my implementation I want to access a database and do a query and I wanted to put the logic into getProperties() which now it seems a bad idea.
best regards Igor
In OpenLiberty, user provided ConfigSources are dynamic and so the system re-reads them regularly. The default refresh interval can be adjusted by setting a System Property called microprofile.config.refresh.rate
. The value is in milliseconds. If you set it to zero then it won't refesh at all. For further information, see here (look for the section titled "Dynamic property values"):
If you would like to comment on or contribute to future MicroProfile Config versions, please get involved at https://github.com/eclipse/microprofile-config/