title: Spring activated profile is being ignored - without Spring Boot
body: <p>I am using spring to run my app. Here is my configuration.yaml</p>
  
  <pre><code>spring:
    profiles:
      default: default
  db:
    host: mysql:3306
    schema: my_db
    user: user
    password: pass
  
  ---
  
  spring:
    profiles: dev
  db:
    host: localhost:3306
  
  ---
  
  spring:
    profiles: prod
  db:
    host: mysql:3306
  </code></pre>
  
  <p>When running the service via intellij I am both tried to set the VM options (<code>-Dspring.profiles.active=dev</code>) and environment variable to <code>SPRING_PROFILES_ACTIVE=dev</code>.<br>
  Both didn't work. It seems like it takes the last profile, in my example it takes the prod profile. </p>
  
  <p>The configuration is loaded via an xml:</p>
  
  <pre><code>  &lt;bean id="yamlProperties" class="org.springframework.beans.factory.config.YamlPropertiesFactoryBean"&gt;
      &lt;property name="resources" value="classpath:config.yaml"/&gt;
    &lt;/bean&gt;
  
    &lt;context:property-placeholder properties-ref="yamlProperties"/&gt;
  </code></pre>
  
  <p>Here is how I boot my app:</p>
  
  <pre><code>fun main(args: Array&lt;String&gt;) {
    val context = ClassPathXmlApplicationContext("/api-applicationContext-all.xml")
    val router = context.getBean("router") as Router
    router.start()
  }
  </code></pre>
  
  <p>What did I do wrong?</p>