Commit ac98d2ac authored by Stephane Nicoll's avatar Stephane Nicoll

Merge pull request #8185 from phillipuniverse:master

* pr/8185:
  Polish "Clarify edge case docs on ConditionalOnClass"
  Clarify edge case docs on ConditionalOnClass
parents a8860ba7 0a55e3e7
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -36,9 +36,11 @@ import org.springframework.context.annotation.Conditional; ...@@ -36,9 +36,11 @@ import org.springframework.context.annotation.Conditional;
public @interface ConditionalOnClass { public @interface ConditionalOnClass {
/** /**
* The classes that must be present. Since this annotation parsed by loading class * 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 * bytecode, it is safe to specify classes here that may ultimately not be on the
* classpath. * 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 * @return the classes that must be present
*/ */
Class<?>[] value() default {}; Class<?>[] value() default {};
......
...@@ -5845,6 +5845,13 @@ actually use the `value` attribute to refer to the real class, even though that ...@@ -5845,6 +5845,13 @@ actually use the `value` attribute to refer to the real class, even though that
might not actually appear on the running application classpath. You can also use the might not actually appear on the running application classpath. You can also use the
`name` attribute if you prefer to specify the class name using a `String` value. `name` attribute if you prefer to specify the class name using a `String` value.
[TIP]
====
If you are using `@ConditionalOnClass` or `@ConditionalOnMissingClass` as apart of a
meta-annotation to compose your own composed annotations you must use `name` as referring
to the class in such a case is not handled.
====
[[boot-features-bean-conditions]] [[boot-features-bean-conditions]]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment