title: change application.properties value in spring boot application using @RefreshScope to take effect during runtime
body: <p>I have a spring boot application that reads a value from a property from application.properties file in the Spring Boot Application. I want to use it as a switch and need to be able to change it during run time so that the code will switch as per the value configured to get the desired output.</p>
  
  <p>As of now it is requiring a restart of the application. Here is what I am using:</p>
  
  <pre><code>    @Configuration
      @RefreshScope
      @PropertySource("classpath:application.properties")
      @Service
      public class MyServiceImpl implements MyService {
  
          @Value("${enabled}")
          private boolean SWITCH_ENABLED;
  
  if (SWITCH_ENABLED==true) {
              // code for switch when true
          }
          else {
              // code for switch is false
          }
  </code></pre>
  
  <p>I have the  following properties in the application.properties :</p>
  
  <p>enabled=true</p>
  
  <p>The value is not getting refreshed and takes effect only after restart. I tried using the spring-boot-actuator as well. </p>