|
|
@ -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");
|
|
|
|
* 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.
|
|
|
@ -24,12 +24,11 @@ import java.lang.annotation.RetentionPolicy;
|
|
|
|
import java.lang.annotation.Target;
|
|
|
|
import java.lang.annotation.Target;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.BeanFactory;
|
|
|
|
import org.springframework.beans.factory.BeanFactory;
|
|
|
|
import org.springframework.context.ApplicationContext;
|
|
|
|
|
|
|
|
import org.springframework.context.annotation.Conditional;
|
|
|
|
import org.springframework.context.annotation.Conditional;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* {@link Conditional} that only matches when the specified bean classes and/or names are
|
|
|
|
* {@link Conditional} that only matches when no beans of the specified classes and/or
|
|
|
|
* not already contained in the {@link BeanFactory}.
|
|
|
|
* with the specified names are already contained in the {@link BeanFactory}.
|
|
|
|
* <p>
|
|
|
|
* <p>
|
|
|
|
* When placed on a {@code @Bean} method, the bean class defaults to the return type of
|
|
|
|
* When placed on a {@code @Bean} method, the bean class defaults to the return type of
|
|
|
|
* the factory method:
|
|
|
|
* the factory method:
|
|
|
@ -64,21 +63,21 @@ import org.springframework.context.annotation.Conditional;
|
|
|
|
public @interface ConditionalOnMissingBean {
|
|
|
|
public @interface ConditionalOnMissingBean {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* The class type of bean that should be checked. The condition matches when each
|
|
|
|
* The class types of beans that should be checked. The condition matches when no bean
|
|
|
|
* class specified is missing in the {@link ApplicationContext}.
|
|
|
|
* of each class specified is contained in the {@link BeanFactory}.
|
|
|
|
* @return the class types of beans to check
|
|
|
|
* @return the class types of beans to check
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
Class<?>[] value() default {};
|
|
|
|
Class<?>[] value() default {};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* The class type names of bean that should be checked. The condition matches when
|
|
|
|
* The class type names of beans that should be checked. The condition matches when no
|
|
|
|
* each class specified is missing in the {@link ApplicationContext}.
|
|
|
|
* bean of each class specified is contained in the {@link BeanFactory}.
|
|
|
|
* @return the class type names of beans to check
|
|
|
|
* @return the class type names of beans to check
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
String[] type() default {};
|
|
|
|
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
|
|
|
|
* @return the class types of beans to ignore
|
|
|
|
* @since 1.2.5
|
|
|
|
* @since 1.2.5
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -95,15 +94,15 @@ public @interface ConditionalOnMissingBean {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* The annotation type decorating a bean that should be checked. The condition matches
|
|
|
|
* The annotation type decorating a bean that should be checked. The condition matches
|
|
|
|
* when each annotation specified is missing from all beans in the
|
|
|
|
* when each annotation specified is missing from all beans in the
|
|
|
|
* {@link ApplicationContext}.
|
|
|
|
* {@link BeanFactory}.
|
|
|
|
* @return the class-level annotation types to check
|
|
|
|
* @return the class-level annotation types to check
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
Class<? extends Annotation>[] annotation() default {};
|
|
|
|
Class<? extends Annotation>[] annotation() default {};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* The names of beans to check. The condition matches when each bean name specified is
|
|
|
|
* The names of beans to check. The condition matches when each bean name specified is
|
|
|
|
* missing in the {@link ApplicationContext}.
|
|
|
|
* missing in the {@link BeanFactory}.
|
|
|
|
* @return the name of beans to check
|
|
|
|
* @return the names of beans to check
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
String[] name() default {};
|
|
|
|
String[] name() default {};
|
|
|
|
|
|
|
|
|
|
|
|