@ConditionalOnBean and @ConditionalOnMissingBean
如果bean存在就执行
@Configuration public class MyAutoConfiguration { @Bean @ConditionalOnMissingBean public MyService myService() { ... } }
@ConditionalOnClass and @ConditionalOnMissingClass
@ConditionalOnProperty
@ConditionalOnResource
@ConditionalOnResource and @ConditionalOnNotWebApplication
@ConditionalOnExpression