Springbootの高度な応用
850 ワード
@ConditionalOnBean and @ConditionalOnMissingBean
beanが存在する場合に実行
@ConditionalOnClass and @ConditionalOnMissingClass
@ConditionalOnProperty
@ConditionalOnResource
@ConditionalOnResource and @ConditionalOnNotWebApplication
@ConditionalOnExpression
beanが存在する場合に実行
@Configuration
public class MyAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public MyService myService() { ... }
}
@ConditionalOnClass and @ConditionalOnMissingClass
@ConditionalOnProperty
@ConditionalOnResource
@ConditionalOnResource and @ConditionalOnNotWebApplication
@ConditionalOnExpression