Cover image for How to refresh/reload application properties runtime in spring boot ?

How to refresh/reload application properties runtime in spring boot ?

vishalpaalakurthi profile image vishalpaalakurthi ・1 min read

In this tutorial, we are going to learn how to reload application properties in spring boot.

We have many options in spring boot, now I am explaining the easiest one here.

Refresh beans with @ConfigurationProperties

For Reloading properties, spring cloud has introduced @RefreshScope annotation which can be used for refreshing beans.

Spring Actuator provides different endpoints for health, metrics. but spring cloud will add extra end point /refresh to reload all the properties.

Required maven/gradle dependencies

  • Spring actuator
  • Spring cloud starter

Then, add below property to application properties file


// Db Properties, Values to be store in a Map

Now, Create a class for configuring properties and add @RefreshScope annotation to class.

@ConfigurationProperties(prefix = "db")
public class DbProperties {

      // This is for storing application properties in a Map
    public Map<String, String> dbProps;

    public Map<String, String> getDbProps() {
        return dbProps;

    public void setDbProps(Map<String, String> dbProps) {
        this.dbProps = dbProps;

        // Get property value using key
    public String getDbPropData(String key) {
        return dbProps.get(key);

Above code create a scope for refreshing application properties data.

Now, when you change data in application properties. we need to give a POST REST call using below URL.


from now, we can get new value from the next access.

Thank you for reading my blog. 🤩

Posted on by:

vishalpaalakurthi profile



Developer | Freelancer | Product Development


Editor guide