title: Run integration tests only if specific spring profile is set
body: <p>We have multiple test classes in our spring boot application. Some of the classes contain integration tests, some contain unit tests.
  These means that if I (e.g. with maven) let all tests to be executed, it will run all tests in all classes.</p>
  
  <p>What I like to achieve is that the integration tests are executed only, if a specific spring profile is set, e.g. via application.yml.
  I like e.g. to annotate the whole test class to define that the tests in this class are only executed if the specified spring profile is set.
  If it is not set, these tests shall be ignored.</p>
  
  <ul>
  <li>The topic <a href="https://stackoverflow.com/q/33016848/4106030">How can I use @IfProfileValue to test if a Profile is active?</a> goes in exactly this direction. <code>@IfProfileValue</code> looks at first glance exactly like it is what I need.
  But as it is pointed out, it is not. I could use it, if I would set a specific system property. But I need to use a real spring profile (and not the system property <code>spring.profiles.active</code> - this would ignore a profile set via <code>application.yml</code>)</li>
  <li><code>@Profile</code> seems to look also to be what I need but as the topic <a href="https://stackoverflow.com/q/53313489/4106030">Use @Profile to decide to execute test class</a> shows, we should not use it.</li>
  </ul>
  
  <p>So what can be done to achieve this?
  Note that there are a lot of questions about tests and spring profiles on stack overflow. But most of them point out how to set configurations in tests specific to spring profiles. That is not would I am looking for.
  I would like to execute or ignore the tests.</p>