I am creating my own spring boot starter to centralise some common configurations in my projects. I would like to let on of my @Configuration classes be only matched, if my spring boot app is annotated in a certain way like so:
@SpringBootApplication
@EnableResourceServer
public class MyApplication {
...
When i use @ConditionalOnClass:
@Configuration
@ConditionalOnClass({EnableResourceServer.class})
class ResourceServerAutoConfiguration
the auto configuration matched when the dependency is used even when the app is not a resource server (annotation is not present).
Is there a condition that only matches when the spring boot app has a certain annotation present?