【发布时间】:2018-04-15 17:28:30
【问题描述】:
通过学习使用spring boot,了解了spring boot ConditionalOnClass的用法和背后的逻辑,我的问题是:
- 为什么“由于这个注解是通过加载类字节码来解析的,所以在这里指定最终可能不在类路径上的类是安全的”。
- JVM 规范在哪里与此相关?
/**
* The classes that must be present. Since this annotation is parsed by loading class
* bytecode, it is safe to specify classes here that may ultimately not be on the
* classpath, only if this annotation is directly on the affected component and
* <b>not</b> if this annotation is used as a composed, meta-annotation. In order to
* use this annotation as a meta-annotation, only use the {@link #name} attribute.
* @return the classes that must be present
*/
Class<?>[] value() default {};
【问题讨论】:
标签: spring spring-boot jvm