title: Using @Profile in spring boot
body: <p>I have spring boot application (<strong>1.1.5.RELEASE</strong>) and enabling my profiles via the configuration protperty <code>spring.profiles.active=MyProfile</code></p>
  
  <p>The profile gets activated correctly which I can see by beans from that profile being created.</p>
  
  <p>Then I have a <code>@Controller</code> used as follows:</p>
  
  <pre><code>@Controller
  @RequestMapping("/someUrl")
  @Profile("MyProfile")
  public class MyController {
  ...
  }
  </code></pre>
  
  <p>This controller is not instantiated and URL used in the controller are not mapped. In the same package I have another controllers which are not limited by <code>@Profile</code> and these get instsantiated and mapped as expected.</p>
  
  <p>So is using <code>@Profile</code> annotation on controller something which is not compatible with spring boot? Is there other approach I should be using?</p>
  
  <p><strong>Edit:</strong> It seems to be a bug after all as if I include <code>-Dspring.profiles.active=MyProfile</code> as JVM property the controller gets instantiated <strong>:'(</strong></p>
  
  <p><strong>Edit2:</strong> So here comes the interesting part:</p>
  
  <ul>
  <li><p>If you define <code>spring.profiles.active</code> in <code>application.properties</code> which is loaded by default from classpath  thne it works</p></li>
  <li><p>when you rename the file to <code>test.properties</code> and include it via <code>@PropertySource("classpath:test.properties")</code> it stops working. Will raise a bug against it.</p></li>
  </ul>
  
  <p><strong>Edit 3:</strong> As promised: <a href="https://github.com/spring-projects/spring-boot/issues/1417">https://github.com/spring-projects/spring-boot/issues/1417</a></p>
  
  <p>Thanks!</p>