title: Load active properties file spring boot
body: <p>I want to read values from an active profile or can say active properties file.
  I have three properties files</p>
  
  <ul>
  <li>application-dev.properties</li>
  <li>application-stage.properties</li>
  <li>application-prod.properties</li>
  </ul>
  
  <p>I have set an active profile to <code>dev</code> as follows</p>
  
  <pre><code>spring.profiles.active=dev
  </code></pre>
  
  <p>My <code>application-dev.properties</code> file has one entry that i want to read in my class.</p>
  
  <p><strong>application-dev.properties</strong> file</p>
  
  <pre><code>fix.connection.type=initiator
  </code></pre>
  
  <p>I tried reading this entry</p>
  
  <pre><code>@Configuration
  @PropertySource("classpath:application-${spring.profiles.active}.properties")
  @Component
  public class AdaptorDestination {
      @Value("${fix.connection.type}")
      private String connectionType;
  }
  </code></pre>
  
  <p><strong>Exception</strong> </p>
  
  <pre><code>nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.profiles.active' in value "classpath:application-${spring.profiles.active}.properties"
  </code></pre>
  
  <p>Please help me out</p>