title: @Profile does not work without Spring Boot (-Dspring.profiles.active with maven)
body: <p>I'm having trouble to make <code>@Profile</code> work with maven and without Spring Boot.
  In pom.xml I have defined maven profiles ("env" and "dev" which is also default).</p>
  
  <p>Unfortunetly whenever I try to build project with:</p>
  
  <pre><code>mvn clean install -Dspring.profiles.active=env 
  </code></pre>
  
  <p>The "default" profile is always applied (in Spring - maven applies "env" for maven purpose).
  I have also tried to make it work with <code>System.getProperty("spring.profiles.active")</code> and <code>System.getenv("spring.profiles.active")</code> but those always returned null. I think it is also worth to mention that this is non-web application.</p>
  
  <p>Beans (to read proper properties):</p>
  
  <pre><code>    @Bean
      @Profile({"default"})
      public static PropertySourcesPlaceholderConfigurer defaultProperties() {
          return getPropertySourcesPlaceholderConfigurer("db.yml");
      }
  
      @Bean
      @Profile({"env"})
      public static PropertySourcesPlaceholderConfigurer envProperties() {
          return getPropertySourcesPlaceholderConfigurer("db-env.yml");
      }
  
      @Bean
      @Profile({"test"})
      public static PropertySourcesPlaceholderConfigurer devProperties() {
          return getPropertySourcesPlaceholderConfigurer("db-test.yml");
      }
  
      private static PropertySourcesPlaceholderConfigurer getPropertySourcesPlaceholderConfigurer(String resource) {
          PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
          YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
          yaml.setResources(new ClassPathResource(resource));
          final Properties object = yaml.getObject();
          if (object != null) {
              propertySourcesPlaceholderConfigurer.setProperties(object);
          }
          return propertySourcesPlaceholderConfigurer;
      }
  </code></pre>
  
  <p>Pom.xml:</p>
  
  <pre><code>&lt;profiles&gt;
      &lt;profile&gt;
        &lt;id&gt;dev&lt;/id&gt;
        &lt;activation&gt;
          &lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
          &lt;property&gt;
            &lt;name&gt;spring.profiles.active&lt;/name&gt;
            &lt;value&gt;dev&lt;/value&gt;
          &lt;/property&gt;
        &lt;/activation&gt;
      &lt;/profile&gt;
      &lt;profile&gt;
        &lt;id&gt;env&lt;/id&gt;
        &lt;activation&gt;
          &lt;property&gt;
            &lt;name&gt;spring.profiles.active&lt;/name&gt;
            &lt;value&gt;env&lt;/value&gt;
          &lt;/property&gt;
        &lt;/activation&gt;
      &lt;/profile&gt;
    &lt;/profiles&gt;
  </code></pre>