Merge pull request #14681 from rweisleder
* pr/14681: Clarify Javadoc of ConditionalOn annotations
This commit is contained in:
		
						commit
						a2203268f9
					
				| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2012-2017 the original author or authors.
 | 
			
		||||
 * Copyright 2012-2018 the original author or authors.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
| 
						 | 
				
			
			@ -24,13 +24,14 @@ import java.lang.annotation.RetentionPolicy;
 | 
			
		|||
import java.lang.annotation.Target;
 | 
			
		||||
 | 
			
		||||
import org.springframework.beans.factory.BeanFactory;
 | 
			
		||||
import org.springframework.context.ApplicationContext;
 | 
			
		||||
import org.springframework.context.annotation.Conditional;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * {@link Conditional} that only matches when the specified bean classes and/or names are
 | 
			
		||||
 * already contained in the {@link BeanFactory}. When placed on a {@code @Bean} method,
 | 
			
		||||
 * the bean class defaults to the return type of the factory method:
 | 
			
		||||
 * {@link Conditional} that only matches when beans of the specified classes and/or with
 | 
			
		||||
 * the specified names are already contained in the {@link BeanFactory}.
 | 
			
		||||
 * <p>
 | 
			
		||||
 * When placed on a {@code @Bean} method, the bean class defaults to the return type of
 | 
			
		||||
 * the factory method:
 | 
			
		||||
 *
 | 
			
		||||
 * <pre class="code">
 | 
			
		||||
 * @Configuration
 | 
			
		||||
| 
						 | 
				
			
			@ -61,15 +62,15 @@ import org.springframework.context.annotation.Conditional;
 | 
			
		|||
public @interface ConditionalOnBean {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * The class type of bean that should be checked. The condition matches when all of
 | 
			
		||||
	 * the classes specified are contained in the {@link ApplicationContext}.
 | 
			
		||||
	 * The class types of beans that should be checked. The condition matches when beans
 | 
			
		||||
	 * of all classes specified are contained in the {@link BeanFactory}.
 | 
			
		||||
	 * @return the class types of beans to check
 | 
			
		||||
	 */
 | 
			
		||||
	Class<?>[] value() default {};
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * The class type names of bean that should be checked. The condition matches when all
 | 
			
		||||
	 * of the classes specified are contained in the {@link ApplicationContext}.
 | 
			
		||||
	 * The class type names of beans that should be checked. The condition matches when
 | 
			
		||||
	 * beans of all classes specified are contained in the {@link BeanFactory}.
 | 
			
		||||
	 * @return the class type names of beans to check
 | 
			
		||||
	 */
 | 
			
		||||
	String[] type() default {};
 | 
			
		||||
| 
						 | 
				
			
			@ -77,15 +78,15 @@ public @interface ConditionalOnBean {
 | 
			
		|||
	/**
 | 
			
		||||
	 * The annotation type decorating a bean that should be checked. The condition matches
 | 
			
		||||
	 * when all of the annotations specified are defined on beans in the
 | 
			
		||||
	 * {@link ApplicationContext}.
 | 
			
		||||
	 * {@link BeanFactory}.
 | 
			
		||||
	 * @return the class-level annotation types to check
 | 
			
		||||
	 */
 | 
			
		||||
	Class<? extends Annotation>[] annotation() default {};
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * The names of beans to check. The condition matches when all of the bean names
 | 
			
		||||
	 * specified are contained in the {@link ApplicationContext}.
 | 
			
		||||
	 * @return the name of beans to check
 | 
			
		||||
	 * specified are contained in the {@link BeanFactory}.
 | 
			
		||||
	 * @return the names of beans to check
 | 
			
		||||
	 */
 | 
			
		||||
	String[] name() default {};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2012-2017 the original author or authors.
 | 
			
		||||
 * Copyright 2012-2018 the original author or authors.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
| 
						 | 
				
			
			@ -24,12 +24,11 @@ import java.lang.annotation.RetentionPolicy;
 | 
			
		|||
import java.lang.annotation.Target;
 | 
			
		||||
 | 
			
		||||
import org.springframework.beans.factory.BeanFactory;
 | 
			
		||||
import org.springframework.context.ApplicationContext;
 | 
			
		||||
import org.springframework.context.annotation.Conditional;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * {@link Conditional} that only matches when the specified bean classes and/or names are
 | 
			
		||||
 * not already contained in the {@link BeanFactory}.
 | 
			
		||||
 * {@link Conditional} that only matches when no beans of the specified classes and/or
 | 
			
		||||
 * with the specified names are already contained in the {@link BeanFactory}.
 | 
			
		||||
 * <p>
 | 
			
		||||
 * When placed on a {@code @Bean} method, the bean class defaults to the return type of
 | 
			
		||||
 * the factory method:
 | 
			
		||||
| 
						 | 
				
			
			@ -64,21 +63,21 @@ import org.springframework.context.annotation.Conditional;
 | 
			
		|||
public @interface ConditionalOnMissingBean {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * The class type of bean that should be checked. The condition matches when each
 | 
			
		||||
	 * class specified is missing in the {@link ApplicationContext}.
 | 
			
		||||
	 * The class types of beans that should be checked. The condition matches when no bean
 | 
			
		||||
	 * of each class specified is contained in the {@link BeanFactory}.
 | 
			
		||||
	 * @return the class types of beans to check
 | 
			
		||||
	 */
 | 
			
		||||
	Class<?>[] value() default {};
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * The class type names of bean that should be checked. The condition matches when
 | 
			
		||||
	 * each class specified is missing in the {@link ApplicationContext}.
 | 
			
		||||
	 * The class type names of beans that should be checked. The condition matches when no
 | 
			
		||||
	 * bean of each class specified is contained in the {@link BeanFactory}.
 | 
			
		||||
	 * @return the class type names of beans to check
 | 
			
		||||
	 */
 | 
			
		||||
	String[] type() default {};
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * The class type of beans that should be ignored when identifying matching beans.
 | 
			
		||||
	 * The class types of beans that should be ignored when identifying matching beans.
 | 
			
		||||
	 * @return the class types of beans to ignore
 | 
			
		||||
	 * @since 1.2.5
 | 
			
		||||
	 */
 | 
			
		||||
| 
						 | 
				
			
			@ -95,15 +94,15 @@ public @interface ConditionalOnMissingBean {
 | 
			
		|||
	/**
 | 
			
		||||
	 * The annotation type decorating a bean that should be checked. The condition matches
 | 
			
		||||
	 * when each annotation specified is missing from all beans in the
 | 
			
		||||
	 * {@link ApplicationContext}.
 | 
			
		||||
	 * {@link BeanFactory}.
 | 
			
		||||
	 * @return the class-level annotation types to check
 | 
			
		||||
	 */
 | 
			
		||||
	Class<? extends Annotation>[] annotation() default {};
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * The names of beans to check. The condition matches when each bean name specified is
 | 
			
		||||
	 * missing in the {@link ApplicationContext}.
 | 
			
		||||
	 * @return the name of beans to check
 | 
			
		||||
	 * missing in the {@link BeanFactory}.
 | 
			
		||||
	 * @return the names of beans to check
 | 
			
		||||
	 */
 | 
			
		||||
	String[] name() default {};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2012-2017 the original author or authors.
 | 
			
		||||
 * Copyright 2012-2018 the original author or authors.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
| 
						 | 
				
			
			@ -23,11 +23,10 @@ import java.lang.annotation.RetentionPolicy;
 | 
			
		|||
import java.lang.annotation.Target;
 | 
			
		||||
 | 
			
		||||
import org.springframework.beans.factory.BeanFactory;
 | 
			
		||||
import org.springframework.context.ApplicationContext;
 | 
			
		||||
import org.springframework.context.annotation.Conditional;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * {@link Conditional} that only matches when the specified bean class is already
 | 
			
		||||
 * {@link Conditional} that only matches when a bean of the specified class is already
 | 
			
		||||
 * contained in the {@link BeanFactory} and a single candidate can be determined.
 | 
			
		||||
 * <p>
 | 
			
		||||
 * The condition will also match if multiple matching bean instances are already contained
 | 
			
		||||
| 
						 | 
				
			
			@ -49,8 +48,8 @@ import org.springframework.context.annotation.Conditional;
 | 
			
		|||
public @interface ConditionalOnSingleCandidate {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * The class type of bean that should be checked. The condition match if the class
 | 
			
		||||
	 * specified is contained in the {@link ApplicationContext} and a primary candidate
 | 
			
		||||
	 * The class type of bean that should be checked. The condition matches if a bean of
 | 
			
		||||
	 * the class specified is contained in the {@link BeanFactory} and a primary candidate
 | 
			
		||||
	 * exists in case of multiple instances.
 | 
			
		||||
	 * <p>
 | 
			
		||||
	 * This attribute may <strong>not</strong> be used in conjunction with
 | 
			
		||||
| 
						 | 
				
			
			@ -60,8 +59,8 @@ public @interface ConditionalOnSingleCandidate {
 | 
			
		|||
	Class<?> value() default Object.class;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * The class type name of bean that should be checked. The condition matches if the
 | 
			
		||||
	 * class specified is contained in the {@link ApplicationContext} and a primary
 | 
			
		||||
	 * The class type name of bean that should be checked. The condition matches if a bean
 | 
			
		||||
	 * of the class specified is contained in the {@link BeanFactory} and a primary
 | 
			
		||||
	 * candidate exists in case of multiple instances.
 | 
			
		||||
	 * <p>
 | 
			
		||||
	 * This attribute may <strong>not</strong> be used in conjunction with
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue