'Springboot- reload property values without server restart

I have a springboot application and an application.properties file from which the values get fetched when the application runs. I am finding a solution to change the property values and reload it without server restart.

Using spring-cloud-config is a solution I know, but I cant use the cloud config in our application . Please suggest if there is any other way to reload the property files using springboot.



Solution 1:[1]

You can use archaius available at https://github.com/Netflix/archaius.

Here is how you use it.

DynamicStringProperty property = getDynamicPropertyFactoryInstance()
    .getStringProperty(key, StringUtils.EMPTY);

You will have to create a wrapper now to read all values from config.properties file. Archaius reads and returns updated values from config.properties file by default.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gaurav