> For the complete documentation index, see [llms.txt](https://jack80342.gitbook.io/spring-boot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jack80342.gitbook.io/spring-boot/iv.-spring-boot-features/46.-creating-your-own-auto-configuration/46.3-condition-annotations/46.3.1-class-conditions.md).

# 46.3.1 Class条件

`@ConditionalOnClass`和`@ConditionalOnMissingClass`注解可以根据特定类是否出现来决定配置的包含。由于注解元数据是使用[ASM](http://asm.ow2.org/)来解析的，所以你可以使用`value`属性来引用真正的类。即使该类没有出现在运行应用的classpath下，也可以使用`name`属性如果你倾向于使用字符串作为类名。

**提示** 如果你正在使用`@ConditionalOnClass`或者`@ConditionalOnMissingClass`，作为元注解的一部分来构成你自己的注解，你必须使用`name`。因为在这种情况下指向class没有被处理。
