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
48703494
Commit
48703494
authored
Nov 28, 2016
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
a2803f41
2be55445
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
18 deletions
+18
-18
EndpointWebMvcChildContextConfiguration.java
...utoconfigure/EndpointWebMvcChildContextConfiguration.java
+1
-1
OnBeanCondition.java
...amework/boot/autoconfigure/condition/OnBeanCondition.java
+1
-1
SearchStrategy.java
...ramework/boot/autoconfigure/condition/SearchStrategy.java
+2
-2
ConditionalOnMissingBeanTests.java
...utoconfigure/condition/ConditionalOnMissingBeanTests.java
+6
-6
ConditionalOnSingleCandidateTests.java
...onfigure/condition/ConditionalOnSingleCandidateTests.java
+8
-8
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java
View file @
48703494
...
...
@@ -151,7 +151,7 @@ public class EndpointWebMvcChildContextConfiguration {
@Configuration
@ConditionalOnClass
({
EnableWebSecurity
.
class
,
Filter
.
class
})
@ConditionalOnBean
(
name
=
"springSecurityFilterChain"
,
search
=
SearchStrategy
.
PARENT
S
)
@ConditionalOnBean
(
name
=
"springSecurityFilterChain"
,
search
=
SearchStrategy
.
ANCESTOR
S
)
public
static
class
EndpointWebMvcChildContextSecurityConfiguration
{
@Bean
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java
View file @
48703494
...
...
@@ -126,7 +126,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
private
List
<
String
>
getMatchingBeans
(
ConditionContext
context
,
BeanSearchSpec
beans
)
{
ConfigurableListableBeanFactory
beanFactory
=
context
.
getBeanFactory
();
if
(
beans
.
getStrategy
()
==
SearchStrategy
.
PARENT
S
)
{
if
(
beans
.
getStrategy
()
==
SearchStrategy
.
ANCESTOR
S
)
{
BeanFactory
parent
=
beanFactory
.
getParentBeanFactory
();
Assert
.
isInstanceOf
(
ConfigurableListableBeanFactory
.
class
,
parent
,
"Unable to use SearchStrategy.PARENTS"
);
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SearchStrategy.java
View file @
48703494
...
...
@@ -29,9 +29,9 @@ public enum SearchStrategy {
CURRENT
,
/**
* Search all
parents and
ancestors, but not the current context.
* Search all ancestors, but not the current context.
*/
PARENT
S
,
ANCESTOR
S
,
/**
* Search the entire hierarchy.
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java
View file @
48703494
...
...
@@ -258,7 +258,7 @@ public class ConditionalOnMissingBeanTests {
}
@Test
public
void
grandparentIsConsideredWhenUsing
Parent
sStrategy
()
{
public
void
grandparentIsConsideredWhenUsing
Ancestor
sStrategy
()
{
this
.
context
.
register
(
ExampleBeanConfiguration
.
class
);
this
.
context
.
refresh
();
AnnotationConfigApplicationContext
parent
=
new
AnnotationConfigApplicationContext
();
...
...
@@ -267,7 +267,7 @@ public class ConditionalOnMissingBeanTests {
AnnotationConfigApplicationContext
child
=
new
AnnotationConfigApplicationContext
();
child
.
setParent
(
parent
);
child
.
register
(
ExampleBeanConfiguration
.
class
,
OnBeanIn
Parent
sConfiguration
.
class
);
OnBeanIn
Ancestor
sConfiguration
.
class
);
child
.
refresh
();
assertThat
(
child
.
getBeansOfType
(
ExampleBean
.
class
)).
hasSize
(
1
);
child
.
close
();
...
...
@@ -275,21 +275,21 @@ public class ConditionalOnMissingBeanTests {
}
@Test
public
void
currentContextIsIgnoredWhenUsing
Parent
sStrategy
()
{
public
void
currentContextIsIgnoredWhenUsing
Ancestor
sStrategy
()
{
this
.
context
.
refresh
();
AnnotationConfigApplicationContext
child
=
new
AnnotationConfigApplicationContext
();
child
.
register
(
ExampleBeanConfiguration
.
class
,
OnBeanIn
Parent
sConfiguration
.
class
);
OnBeanIn
Ancestor
sConfiguration
.
class
);
child
.
setParent
(
this
.
context
);
child
.
refresh
();
assertThat
(
child
.
getBeansOfType
(
ExampleBean
.
class
)).
hasSize
(
2
);
}
@Configuration
protected
static
class
OnBeanIn
Parent
sConfiguration
{
protected
static
class
OnBeanIn
Ancestor
sConfiguration
{
@Bean
@ConditionalOnMissingBean
(
search
=
SearchStrategy
.
PARENT
S
)
@ConditionalOnMissingBean
(
search
=
SearchStrategy
.
ANCESTOR
S
)
public
ExampleBean
exampleBean2
()
{
return
new
ExampleBean
(
"test"
);
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnSingleCandidateTests.java
View file @
48703494
...
...
@@ -63,11 +63,11 @@ public class ConditionalOnSingleCandidateTests {
}
@Test
public
void
singleCandidateIn
Parent
sOneCandidateInCurrent
()
{
public
void
singleCandidateIn
Ancestor
sOneCandidateInCurrent
()
{
load
();
AnnotationConfigApplicationContext
child
=
new
AnnotationConfigApplicationContext
();
child
.
register
(
FooConfiguration
.
class
,
OnBeanSingleCandidateIn
Parent
sConfiguration
.
class
);
OnBeanSingleCandidateIn
Ancestor
sConfiguration
.
class
);
child
.
setParent
(
this
.
context
);
child
.
refresh
();
assertThat
(
child
.
containsBean
(
"baz"
)).
isFalse
();
...
...
@@ -75,10 +75,10 @@ public class ConditionalOnSingleCandidateTests {
}
@Test
public
void
singleCandidateIn
Parent
sOneCandidateInParent
()
{
public
void
singleCandidateIn
Ancestor
sOneCandidateInParent
()
{
load
(
FooConfiguration
.
class
);
AnnotationConfigApplicationContext
child
=
new
AnnotationConfigApplicationContext
();
child
.
register
(
OnBeanSingleCandidateIn
Parent
sConfiguration
.
class
);
child
.
register
(
OnBeanSingleCandidateIn
Ancestor
sConfiguration
.
class
);
child
.
setParent
(
this
.
context
);
child
.
refresh
();
assertThat
(
child
.
containsBean
(
"baz"
)).
isTrue
();
...
...
@@ -87,13 +87,13 @@ public class ConditionalOnSingleCandidateTests {
}
@Test
public
void
singleCandidateIn
Parent
sOneCandidateInGrandparent
()
{
public
void
singleCandidateIn
Ancestor
sOneCandidateInGrandparent
()
{
load
(
FooConfiguration
.
class
);
AnnotationConfigApplicationContext
parent
=
new
AnnotationConfigApplicationContext
();
parent
.
setParent
(
this
.
context
);
parent
.
refresh
();
AnnotationConfigApplicationContext
child
=
new
AnnotationConfigApplicationContext
();
child
.
register
(
OnBeanSingleCandidateIn
Parent
sConfiguration
.
class
);
child
.
register
(
OnBeanSingleCandidateIn
Ancestor
sConfiguration
.
class
);
child
.
setParent
(
parent
);
child
.
refresh
();
assertThat
(
child
.
containsBean
(
"baz"
)).
isTrue
();
...
...
@@ -177,8 +177,8 @@ public class ConditionalOnSingleCandidateTests {
}
@Configuration
@ConditionalOnSingleCandidate
(
value
=
String
.
class
,
search
=
SearchStrategy
.
PARENT
S
)
protected
static
class
OnBeanSingleCandidateIn
Parent
sConfiguration
{
@ConditionalOnSingleCandidate
(
value
=
String
.
class
,
search
=
SearchStrategy
.
ANCESTOR
S
)
protected
static
class
OnBeanSingleCandidateIn
Ancestor
sConfiguration
{
@Bean
public
String
baz
(
String
s
)
{
...
...
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