title: Adding @Conditional to an existing spring annotation in spring boot
body: <p><br>
  I have an application which uses an existing spring annotation (<code>@EnableResourceServer</code>). I want this particular annotation to be enabled only when a particular property value is not false.
  To do this, I created a meta-annotation and applied <code>@ConditionalOnProperty</code> on that :</p>
  
  <pre><code>@Target(ElementType.TYPE)
  @Retention(RetentionPolicy.RUNTIME)
  @ConditionalOnProperty(prefix = "custom.resource", name = "enabled", matchIfMissing = true)
  @EnableResourceServer
  public @interface EnableCustomResourceSecurity {
  }
  </code></pre>
  
  <p>In my application I'm now using <code>@EnableCustomResourceSecurity</code> like :</p>
  
  <pre><code>@EnableCustomResourceSecurity
  @SpringBootApplication
  public class MyApplication {
  
      public static void main(String[] args) {
      SpringApplication.run(MyApplication.class, args);
      }
  
  }
  </code></pre>
  
  <p>and it all works fine if the property is missing or true but when I change the property to <code>custom.resource.enabled=false</code> I get the following exception :</p>
  
  <pre><code>org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
  </code></pre>
  
  <p>I tried putting this annotation in a couple of other places and noticed that when the conditional expression fails for this annotation, any annotation after this also stops getting processed.</p>
  
  <p>What would be the correct way to achieve what I'm trying to do?</p>