Skip to content

Commit 03ade48

Browse files
committed
Expound on inheritance semantics for @conditional
Issue: SPR-11598
1 parent dc39e35 commit 03ade48

File tree

1 file changed

+14
-7
lines changed
  • spring-context/src/main/java/org/springframework/context/annotation

1 file changed

+14
-7
lines changed

spring-context/src/main/java/org/springframework/context/annotation/Conditional.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@
2323

2424
/**
2525
* Indicates that a component is only eligible for registration when all
26-
* {@linkplain #value() specified conditions} match.
26+
* {@linkplain #value specified conditions} match.
2727
*
2828
* <p>A <em>condition</em> is any state that can be determined programmatically
2929
* before the bean definition is due to be registered (see {@link Condition} for details).
@@ -37,14 +37,21 @@
3737
* <li>as a method-level annotation on any {@link Bean @Bean} method</li>
3838
* </ul>
3939
*
40-
* <p>If a {@code @Configuration} class is marked with {@code @Conditional}, all of the
41-
* {@code @Bean} methods, {@link Import @Import} and {@link ComponentScan @ComponentScan}
42-
* annotations associated with that class will be subject to the conditions.
40+
* <p>If a {@code @Configuration} class is marked with {@code @Conditional},
41+
* all of the {@code @Bean} methods, {@link Import @Import} annotations, and
42+
* {@link ComponentScan @ComponentScan} annotations associated with that
43+
* class will be subject to the conditions.
4344
*
44-
* <p>NOTE: {@code @Conditional} annotations are not inherited; any conditions from
45-
* superclasses or from overridden methods are not being considered.
45+
* <p><strong>NOTE</strong>: Inheritance of {@code @Conditional} annotations
46+
* is not supported; any conditions from superclasses or from overridden
47+
* methods will not be considered. In order to enforce these semantics,
48+
* {@code @Conditional} itself is not declared as
49+
* {@link java.lang.annotation.Inherited @Inherited}; furthermore, any
50+
* custom <em>composed annotation</em> that is meta-annotated with
51+
* {@code @Conditional} must not be declared as {@code @Inherited}.
4652
*
4753
* @author Phillip Webb
54+
* @author Sam Brannen
4855
* @since 4.0
4956
* @see Condition
5057
*/

0 commit comments

Comments
 (0)