title: Spring-boot, JUnit tests using different profiles
body: <p>I'm trying to use application.properties profiles for integration tests using JUnit in order to check two different platforms. </p>
  
  <p>I tried doing so with basic configuration file <code>application.properties</code> which contains the common configurations for both platforms, and on top of that I've added properties files <code>application-tensorflow.properties</code> <code>application-caffe.properties</code> for each platform, which have specific platform configurations, but I found out that it works differently in JUnit than the approach I used to use in the main application.</p>
  
  <p>my test configuration class looks like this: </p>
  
  <pre><code>@Configuration
  @PropertySource("classpath:application.properties")
  @CompileStatic
  @EnableConfigurationProperties
  class TestConfig {...}
  </code></pre>
  
  <p>I'm using <code>@PropertySource("classpath:application.properties")</code> so it will recognize my basic configurations, there I also write <code>spring.profiles.active=tensorflow</code>, in hope that it will recognize the tensorflow application profile however it doesn't read from the file: <code>/src/test/resources/application-tensorflow.properties</code>, nor from <code>/src/main/resources/application-tensorflow.properties</code> as it does in main app.</p>
  
  <p>Is there special a way to specify a spring profile in JUnit test? What is the best practice to achieve what I'm trying to do? </p>