Skip to content

Commit 4870349

Browse files
committed
Merge branch '1.5.x'
2 parents a2803f4 + 2be5544 commit 4870349

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public void handlerMapping(MvcEndpoints endpoints,
151151

152152
@Configuration
153153
@ConditionalOnClass({ EnableWebSecurity.class, Filter.class })
154-
@ConditionalOnBean(name = "springSecurityFilterChain", search = SearchStrategy.PARENTS)
154+
@ConditionalOnBean(name = "springSecurityFilterChain", search = SearchStrategy.ANCESTORS)
155155
public static class EndpointWebMvcChildContextSecurityConfiguration {
156156

157157
@Bean

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ else if (!hasSingleAutowireCandidate(context.getBeanFactory(), matching,
126126
private List<String> getMatchingBeans(ConditionContext context,
127127
BeanSearchSpec beans) {
128128
ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
129-
if (beans.getStrategy() == SearchStrategy.PARENTS) {
129+
if (beans.getStrategy() == SearchStrategy.ANCESTORS) {
130130
BeanFactory parent = beanFactory.getParentBeanFactory();
131131
Assert.isInstanceOf(ConfigurableListableBeanFactory.class, parent,
132132
"Unable to use SearchStrategy.PARENTS");

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SearchStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ public enum SearchStrategy {
2929
CURRENT,
3030

3131
/**
32-
* Search all parents and ancestors, but not the current context.
32+
* Search all ancestors, but not the current context.
3333
*/
34-
PARENTS,
34+
ANCESTORS,
3535

3636
/**
3737
* Search the entire hierarchy.

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ public void testOnMissingBeanConditionWithIgnoredSubclassByName() {
258258
}
259259

260260
@Test
261-
public void grandparentIsConsideredWhenUsingParentsStrategy() {
261+
public void grandparentIsConsideredWhenUsingAncestorsStrategy() {
262262
this.context.register(ExampleBeanConfiguration.class);
263263
this.context.refresh();
264264
AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext();
@@ -267,29 +267,29 @@ public void grandparentIsConsideredWhenUsingParentsStrategy() {
267267
AnnotationConfigApplicationContext child = new AnnotationConfigApplicationContext();
268268
child.setParent(parent);
269269
child.register(ExampleBeanConfiguration.class,
270-
OnBeanInParentsConfiguration.class);
270+
OnBeanInAncestorsConfiguration.class);
271271
child.refresh();
272272
assertThat(child.getBeansOfType(ExampleBean.class)).hasSize(1);
273273
child.close();
274274
parent.close();
275275
}
276276

277277
@Test
278-
public void currentContextIsIgnoredWhenUsingParentsStrategy() {
278+
public void currentContextIsIgnoredWhenUsingAncestorsStrategy() {
279279
this.context.refresh();
280280
AnnotationConfigApplicationContext child = new AnnotationConfigApplicationContext();
281281
child.register(ExampleBeanConfiguration.class,
282-
OnBeanInParentsConfiguration.class);
282+
OnBeanInAncestorsConfiguration.class);
283283
child.setParent(this.context);
284284
child.refresh();
285285
assertThat(child.getBeansOfType(ExampleBean.class)).hasSize(2);
286286
}
287287

288288
@Configuration
289-
protected static class OnBeanInParentsConfiguration {
289+
protected static class OnBeanInAncestorsConfiguration {
290290

291291
@Bean
292-
@ConditionalOnMissingBean(search = SearchStrategy.PARENTS)
292+
@ConditionalOnMissingBean(search = SearchStrategy.ANCESTORS)
293293
public ExampleBean exampleBean2() {
294294
return new ExampleBean("test");
295295
}

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnSingleCandidateTests.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,22 @@ public void singleCandidateOneCandidate() {
6363
}
6464

6565
@Test
66-
public void singleCandidateInParentsOneCandidateInCurrent() {
66+
public void singleCandidateInAncestorsOneCandidateInCurrent() {
6767
load();
6868
AnnotationConfigApplicationContext child = new AnnotationConfigApplicationContext();
6969
child.register(FooConfiguration.class,
70-
OnBeanSingleCandidateInParentsConfiguration.class);
70+
OnBeanSingleCandidateInAncestorsConfiguration.class);
7171
child.setParent(this.context);
7272
child.refresh();
7373
assertThat(child.containsBean("baz")).isFalse();
7474
child.close();
7575
}
7676

7777
@Test
78-
public void singleCandidateInParentsOneCandidateInParent() {
78+
public void singleCandidateInAncestorsOneCandidateInParent() {
7979
load(FooConfiguration.class);
8080
AnnotationConfigApplicationContext child = new AnnotationConfigApplicationContext();
81-
child.register(OnBeanSingleCandidateInParentsConfiguration.class);
81+
child.register(OnBeanSingleCandidateInAncestorsConfiguration.class);
8282
child.setParent(this.context);
8383
child.refresh();
8484
assertThat(child.containsBean("baz")).isTrue();
@@ -87,13 +87,13 @@ public void singleCandidateInParentsOneCandidateInParent() {
8787
}
8888

8989
@Test
90-
public void singleCandidateInParentsOneCandidateInGrandparent() {
90+
public void singleCandidateInAncestorsOneCandidateInGrandparent() {
9191
load(FooConfiguration.class);
9292
AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext();
9393
parent.setParent(this.context);
9494
parent.refresh();
9595
AnnotationConfigApplicationContext child = new AnnotationConfigApplicationContext();
96-
child.register(OnBeanSingleCandidateInParentsConfiguration.class);
96+
child.register(OnBeanSingleCandidateInAncestorsConfiguration.class);
9797
child.setParent(parent);
9898
child.refresh();
9999
assertThat(child.containsBean("baz")).isTrue();
@@ -177,8 +177,8 @@ public String baz(String s) {
177177
}
178178

179179
@Configuration
180-
@ConditionalOnSingleCandidate(value = String.class, search = SearchStrategy.PARENTS)
181-
protected static class OnBeanSingleCandidateInParentsConfiguration {
180+
@ConditionalOnSingleCandidate(value = String.class, search = SearchStrategy.ANCESTORS)
181+
protected static class OnBeanSingleCandidateInAncestorsConfiguration {
182182

183183
@Bean
184184
public String baz(String s) {

0 commit comments

Comments
 (0)