springboot的高级应用

@ConditionalOnBean and @ConditionalOnMissingBean

如果bean存在就执行

@Configuration
public class MyAutoConfiguration {

	@Bean
	@ConditionalOnMissingBean
	public MyService myService() { ... }

}

@ConditionalOnClass and @ConditionalOnMissingClass

@ConditionalOnProperty

@ConditionalOnResource

@ConditionalOnResource and @ConditionalOnNotWebApplication

@ConditionalOnExpression


你可能感兴趣的:(springboot的高级应用)