title: Defining a spring active profile within a test use case
body: <p>Using Spring 4, I've got the following test setup:</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(classes = JpaConfig.class)
  @ActiveProfiles(resolver = TestResolver.class)
  public class SimpleTest {
  </code></pre>
  
  <p>The TestResolver has been implemented as:</p>
  
  <pre><code>public class TestResolver implements ActiveProfilesResolver {
      @Override
      public String[] resolve(Class&lt;?&gt; aClass) {
          String[] profiles = new String[1];
          profiles[0] = "test";
          return profiles;
      }
  }
  </code></pre>
  
  <p>JpaConfig has been annotated with PropertySource</p>
  
  <pre><code>@Configuration
  @PropertySource("classpath:properties/application-${spring.profiles.active:dev}.properties")
  @EnableJpaRepositories(basePackages={"com.my.namespace.repositories"})
  public class JpaConfig {
  </code></pre>
  
  <p>Whenever I run the SimpleTest it tries to locate: properties/application-dev.properties while I expected it to be properties/application-test.properties.</p>
  
  <p>What's I'm trying to accomplish here has been based on the following post: <a href="https://stackoverflow.com/questions/20551681/spring-integration-tests-with-profile">Spring integration tests with profile</a></p>