title: Spring Boot 2.4.x - @RefreshScope is not working
body: <p>I already went through many links like <a href="https://stackoverflow.com/questions/49311068/refreshscope-and-refresh-not-working">@RefreshScope and /refresh not working</a> and <a href="https://stackoverflow.com/questions/49363043/spring-boot-2-refresh-properties-on-the-fly-not-working">Spring Boot 2: Refresh properties on the fly not working</a>, but still things are not working for me.</p>
  <p>I've developed spring-cloud-config-server</p>
  <p>when I hit</p>
  <blockquote>
  <p>POST ==&gt; http://localhost:8002/actuator/refresh</p>
  </blockquote>
  <p>I get the response</p>
  <blockquote>
  <p>[
  &quot;config.client.version&quot;
  ]</p>
  </blockquote>
  <p>It looks like its somehow not loading the changed properties</p>
  <p>pom.xml:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
      xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
      xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.4.2&lt;/version&gt;
          &lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
      &lt;groupId&gt;com.example&lt;/groupId&gt;
      &lt;artifactId&gt;user-service&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;user-service&lt;/name&gt;
      &lt;description&gt;Demo project for Spring Boot&lt;/description&gt;
      &lt;properties&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
          &lt;spring-cloud.version&gt;2020.0.2&lt;/spring-cloud.version&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
              &lt;artifactId&gt;spring-cloud-starter-config&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
              &lt;artifactId&gt;spring-cloud-starter-netflix-eureka-client&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
              &lt;artifactId&gt;spring-cloud-starter-bootstrap&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
              &lt;artifactId&gt;spring-cloud-starter-openfeign&lt;/artifactId&gt;
          &lt;/dependency&gt;
           &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
              &lt;artifactId&gt;spring-cloud-starter-circuitbreaker-resilience4j&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
              &lt;optional&gt;true&lt;/optional&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;dependencyManagement&gt;
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-cloud-dependencies&lt;/artifactId&gt;
                  &lt;version&gt;${spring-cloud.version}&lt;/version&gt;
                  &lt;type&gt;pom&lt;/type&gt;
                  &lt;scope&gt;import&lt;/scope&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;excludes&gt;
                          &lt;exclude&gt;
                              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
                              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
                          &lt;/exclude&gt;
                      &lt;/excludes&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>PropertyAccessBean.java:</p>
  <pre class="lang-java prettyprint-override"><code>@Component
  @ConfigurationProperties(prefix=&quot;property-file&quot;)
  public class PropertyAccessBean {
  
      private String name;
      private String description;
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getDescription() {
          return description;
      }
  
      public void setDescription(String description) {
          this.description = description;
      }
  }
  </code></pre>
  <p>PropertyAccessValue.java:</p>
  <pre class="lang-java prettyprint-override"><code>public class PropertyAccessValue {
  
      private String name;
      private String description;
  
  
      public PropertyAccessValue(String name, String description) {
          this.name = name;
          this.description = description;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getDescription() {
          return description;
      }
  
      public void setDescription(String description) {
          this.description = description;
      }
  
      @Override
      public String toString() {
          return &quot;PropertyAccessValue{&quot; +
                  &quot;name='&quot; + name + '\'' +
                  &quot;, description='&quot; + description + '\'' +
                  '}';
      }
  }
  </code></pre>
  <p>UserController.java:</p>
  <pre class="lang-java prettyprint-override"><code>@RestController
  @RequestMapping(&quot;/users&quot;)
  @RefreshScope
  @Slf4j
  public class UserController {
  
      @Autowired
      private UserService userService;
  
      @PostMapping(&quot;/&quot;)
      public User saveUser(@RequestBody User user) {
          log.info(&quot;Inside saveUser of UserController&quot;);
          return userService.saveUser(user);
      }
  
      @GetMapping(&quot;/{id}&quot;)
      public ResponseTemplateVO getUserWithDepartment(@PathVariable(&quot;id&quot;) Long userId) {
          log.info(&quot;Inside getUserWithDepartment of UserController&quot;);
  //      return userService.getUserWithDepartment(userId);
          
  //      return userService.getUserWithDepartmentWithFeign(userId);
          
          return userService.getUserWithDepartmentWithFeignAndResilient4J(userId);
      }
      
      
      @Autowired
      PropertyAccessBean propertyAccessBean;
  
      @GetMapping(&quot;/readkey&quot;)
      public PropertyAccessValue accesPropertyFile(){
  
          return new PropertyAccessValue(propertyAccessBean.getName(),
                  propertyAccessBean.getDescription());
      }
  }
  </code></pre>
  
  <p>bootstrap.properties:</p>
  <pre class="lang-yaml prettyprint-override"><code>spring:
    cloud:
      config:
        enabled: true
        uri: http://localhost:9296
        
  </code></pre>
  <p>application.yml:</p>
  <pre class="lang-yaml prettyprint-override"><code>server:
    port: 8002
  
  spring:
    application:
      name: user-service 
  
  resilience4j:
    circuitbreaker:
      instances:
        department:
          register-health-indicator: true
          ring-buffer-size-in-closed-state: 5
          ring-buffer-size-in-half-open-state: 3
          wait-duration-in-open-state: 10s
          failure-rate-threshold: 50
          record-exceptions:
          - org.springframework.web.client.HttpServerErrorException
          - org.springframework.web.client.ResourceAccessException
          - java.util.concurrent.TimeoutException
          - java.io.IOException
          
  
  management:
    endpoints:
      web:
        exposure:
          include: refresh
    endpoint:
      health:
        show-details: always
        
  
             
  </code></pre>