spring_reference/IV. Spring Boot features/36.3. Condition annotations.md

6 lines
439 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

### 36.3. Condition注解
你几乎总是需要在你的auto-configuration类里添加一个或更多的@Condition注解。@ConditionalOnMissingBean注解是一个常见的示例它经常用于允许开发者覆盖auto-configuration如果他们不喜欢你提供的默认行为。
Spring Boot包含很多@Conditional注解你可以在自己的代码中通过注解@Configuration类或单独的@Bean方法来重用它们。