spring_reference/IV. Spring Boot features/36.3.1. Class conditions.md

4 lines
427 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.1. Class条件
@ConditionalOnClass和@ConditionalOnMissingClass注解允许根据特定类是否出现来跳过配置。由于注解元数据是使用[ASM](http://asm.ow2.org/)来解析的你实际上可以使用value属性来引用真正的类即使该类可能实际上并没有出现在运行应用的classpath下。如果你倾向于使用一个String值来指定类名你也可以使用name属性。