在开发一个 Spring Boot Starter 时,你希望你的自动配置类 `MyAutoConfiguration` 仅在两个条件同时满足时生效:1. classpath 中存在 `com.example.ExternalLibrary` 这个类;2. 配置文件中 `myapp.feature.enabled` 的值为 `true`。你应该如何组合使用条件注解来实现这个目标?
在 MyAutoConfiguration 上同时使用 @ConditionalOnClass 和 @ConditionalOnProperty(name="myapp.feature.enabled", havingValue="true")
在 MyAutoConfiguration 上使用 @ConditionalOnBean(com.example.ExternalLibrary.class) 和 @ConditionalOnProperty(name="myapp.feature.enabled", havingValue="true")
在 MyAutoConfiguration 上使用 @ConditionalOnMissingClass("com.example.ExternalLibrary") 和 @ConditionalOnProperty(name="myapp.feature.enabled", havingValue="true")
只需要使用 @ConditionalOnProperty(name="myapp.feature.enabled", havingValue="true"),因为 Spring Boot 会自动检测类是否存在