Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
d445ed75
Commit
d445ed75
authored
Oct 04, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.0.x'
parents
da7daece
a2203268
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
31 deletions
+30
-31
ConditionalOnBean.java
...ework/boot/autoconfigure/condition/ConditionalOnBean.java
+13
-12
ConditionalOnMissingBean.java
...oot/autoconfigure/condition/ConditionalOnMissingBean.java
+11
-12
ConditionalOnSingleCandidate.java
...autoconfigure/condition/ConditionalOnSingleCandidate.java
+6
-7
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBean.java
View file @
d445ed75
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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,13 +24,14 @@ import java.lang.annotation.RetentionPolicy;
...
@@ -24,13 +24,14 @@ 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 beans of the specified classes and/or with
* already contained in the {@link BeanFactory}. When placed on a {@code @Bean} method,
* the specified names are already contained in the {@link BeanFactory}.
* the bean class defaults to the return type of the factory method:
* <p>
* When placed on a {@code @Bean} method, the bean class defaults to the return type of
* the factory method:
*
*
* <pre class="code">
* <pre class="code">
* @Configuration
* @Configuration
...
@@ -61,15 +62,15 @@ import org.springframework.context.annotation.Conditional;
...
@@ -61,15 +62,15 @@ import org.springframework.context.annotation.Conditional;
public
@interface
ConditionalOnBean
{
public
@interface
ConditionalOnBean
{
/**
/**
* The class type
of bean that should be checked. The condition matches when all of
* The class type
s of beans that should be checked. The condition matches when beans
*
the classes specified are contained in the {@link ApplicationContext
}.
*
of all classes specified are 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 all
* The class type names of bean
s that should be checked. The condition matches when
*
of the classes specified are contained in the {@link ApplicationContext
}.
*
beans of all classes specified are 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
{};
...
@@ -77,15 +78,15 @@ public @interface ConditionalOnBean {
...
@@ -77,15 +78,15 @@ public @interface ConditionalOnBean {
/**
/**
* 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 all of the annotations specified are defined on beans in the
* when all of the annotations specified are defined on 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 all of the bean names
* The names of beans to check. The condition matches when all of the bean names
* specified are contained in the {@link
ApplicationContext
}.
* specified are contained in the {@link
BeanFactory
}.
* @return the name of beans to check
* @return the name
s
of beans to check
*/
*/
String
[]
name
()
default
{};
String
[]
name
()
default
{};
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBean.java
View file @
d445ed75
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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;
...
@@ -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;
...
@@ -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 type
s 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 bean
s 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 type
s
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 {
...
@@ -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 name
s
of beans to check
*/
*/
String
[]
name
()
default
{};
String
[]
name
()
default
{};
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnSingleCandidate.java
View file @
d445ed75
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
@@ -23,11 +23,10 @@ import java.lang.annotation.RetentionPolicy;
...
@@ -23,11 +23,10 @@ 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
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.
* contained in the {@link BeanFactory} and a single candidate can be determined.
* <p>
* <p>
* The condition will also match if multiple matching bean instances are already contained
* The condition will also match if multiple matching bean instances are already contained
...
@@ -49,8 +48,8 @@ import org.springframework.context.annotation.Conditional;
...
@@ -49,8 +48,8 @@ import org.springframework.context.annotation.Conditional;
public
@interface
ConditionalOnSingleCandidate
{
public
@interface
ConditionalOnSingleCandidate
{
/**
/**
* The class type of bean that should be checked. The condition match
if the class
* The class type of bean that should be checked. The condition match
es if a bean of
*
specified is contained in the {@link ApplicationContext
} and a primary candidate
*
the class specified is contained in the {@link BeanFactory
} and a primary candidate
* exists in case of multiple instances.
* exists in case of multiple instances.
* <p>
* <p>
* This attribute may <strong>not</strong> be used in conjunction with
* This attribute may <strong>not</strong> be used in conjunction with
...
@@ -60,8 +59,8 @@ public @interface ConditionalOnSingleCandidate {
...
@@ -60,8 +59,8 @@ public @interface ConditionalOnSingleCandidate {
Class
<?>
value
()
default
Object
.
class
;
Class
<?>
value
()
default
Object
.
class
;
/**
/**
* The class type name of bean that should be checked. The condition matches if
the
* The class type name of bean that should be checked. The condition matches if
a bean
*
class specified is contained in the {@link ApplicationContext
} and a primary
*
of the class specified is contained in the {@link BeanFactory
} and a primary
* candidate exists in case of multiple instances.
* candidate exists in case of multiple instances.
* <p>
* <p>
* This attribute may <strong>not</strong> be used in conjunction with
* This attribute may <strong>not</strong> be used in conjunction with
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment