@Retention(value=RUNTIME) @Target(value={TYPE,METHOD}) public @interface Conditional
A condition is any state that can be determined programmatically
before the bean definition is due to be registered (see Condition
for details).
The @Conditional
annotation may be used in any of the following ways:
@Component
, including @Configuration
classes@Bean
methodIf a @Configuration
class is marked with @Conditional
, all of the
@Bean
methods, @Import
and @ComponentScan
annotations associated with that class will be subject to the conditions.
NOTE: @Conditional
annotations are not inherited; any conditions from
superclasses or from overridden methods are not being considered.
Condition