Skip to content

Commit da4f436

Browse files
committed
Change SearchStrategy EXHAUSTIVE to TYPE_HIERARCHY
Fixup references following upstream Spring Framework change.
1 parent 5926547 commit da4f436

File tree

17 files changed

+23
-22
lines changed

17 files changed

+23
-22
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/AbstractEndpointCondition.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected Class<?> getEndpointType(Class<?> annotationClass, ConditionContext co
101101
}
102102

103103
protected AnnotationAttributes getEndpointAttributes(Class<?> type) {
104-
MergedAnnotations annotations = MergedAnnotations.from(type, SearchStrategy.EXHAUSTIVE);
104+
MergedAnnotations annotations = MergedAnnotations.from(type, SearchStrategy.TYPE_HIERARCHY);
105105
MergedAnnotation<Endpoint> endpoint = annotations.get(Endpoint.class);
106106
if (endpoint.isPresent()) {
107107
return endpoint.asAnnotationAttributes();

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,8 @@ private static class EndpointBean {
403403
private Set<ExtensionBean> extensions = new LinkedHashSet<>();
404404

405405
EndpointBean(String beanName, Object bean) {
406-
MergedAnnotation<Endpoint> annotation = MergedAnnotations.from(bean.getClass(), SearchStrategy.EXHAUSTIVE)
407-
.get(Endpoint.class);
406+
MergedAnnotation<Endpoint> annotation = MergedAnnotations
407+
.from(bean.getClass(), SearchStrategy.TYPE_HIERARCHY).get(Endpoint.class);
408408
String id = annotation.getString("id");
409409
Assert.state(StringUtils.hasText(id),
410410
() -> "No @Endpoint id attribute specified for " + bean.getClass().getName());
@@ -470,7 +470,7 @@ private static class ExtensionBean {
470470
.get(EndpointExtension.class);
471471
Class<?> endpointType = extensionAnnotation.getClass("endpoint");
472472
MergedAnnotation<Endpoint> endpointAnnotation = MergedAnnotations
473-
.from(endpointType, SearchStrategy.EXHAUSTIVE).get(Endpoint.class);
473+
.from(endpointType, SearchStrategy.TYPE_HIERARCHY).get(Endpoint.class);
474474
Assert.state(endpointAnnotation.isPresent(),
475475
() -> "Extension " + endpointType.getName() + " does not specify an endpoint");
476476
this.endpointId = EndpointId.of(endpointAnnotation.getString("id"));

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public void beforeEach(ExtensionContext extensionContext) throws Exception {
153153
}
154154

155155
private boolean isConfiguration(Class<?> candidate) {
156-
return MergedAnnotations.from(candidate, SearchStrategy.EXHAUSTIVE).isPresent(Configuration.class);
156+
return MergedAnnotations.from(candidate, SearchStrategy.TYPE_HIERARCHY).isPresent(Configuration.class);
157157
}
158158

159159
@Override

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Set<String> getNamesForAnnotation(Class<? extends Annotation> annotation) {
117117
updateTypesIfNecessary();
118118
return this.beanTypes.entrySet().stream()
119119
.filter((entry) -> entry.getValue() != null && MergedAnnotations
120-
.from(entry.getValue().resolve(), MergedAnnotations.SearchStrategy.EXHAUSTIVE)
120+
.from(entry.getValue().resolve(), MergedAnnotations.SearchStrategy.TYPE_HIERARCHY)
121121
.isPresent(annotation))
122122
.map(Map.Entry::getKey).collect(Collectors.toCollection(LinkedHashSet::new));
123123
}

spring-boot-project/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
@@ -566,7 +566,7 @@ private Method findBeanMethod(Class<?> declaringClass, String methodName) {
566566
}
567567

568568
private boolean isBeanMethod(Method method) {
569-
return method != null && MergedAnnotations.from(method, MergedAnnotations.SearchStrategy.EXHAUSTIVE)
569+
return method != null && MergedAnnotations.from(method, MergedAnnotations.SearchStrategy.TYPE_HIERARCHY)
570570
.isPresent(Bean.class);
571571
}
572572

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/DefaultJerseyApplicationPath.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private String resolveApplicationPath() {
5353
return this.applicationPath;
5454
}
5555
// Jersey doesn't like to be the default servlet, so map to /* as a fallback
56-
return MergedAnnotations.from(this.config.getApplication().getClass(), SearchStrategy.EXHAUSTIVE)
56+
return MergedAnnotations.from(this.config.getApplication().getClass(), SearchStrategy.TYPE_HIERARCHY)
5757
.get(ApplicationPath.class).getValue(MergedAnnotation.VALUE, String.class).orElse("/*");
5858
}
5959

spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class OverrideAutoConfigurationContextCustomizerFactory implements ContextCustom
3939
@Override
4040
public ContextCustomizer createContextCustomizer(Class<?> testClass,
4141
List<ContextConfigurationAttributes> configurationAttributes) {
42-
boolean enabled = MergedAnnotations.from(testClass, SearchStrategy.EXHAUSTIVE)
42+
boolean enabled = MergedAnnotations.from(testClass, SearchStrategy.TYPE_HIERARCHY)
4343
.get(OverrideAutoConfiguration.class).getValue("enabled", Boolean.class).orElse(true);
4444
return !enabled ? new DisableAutoConfigurationContextCustomizer() : null;
4545
}

spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizerFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ImportsContextCustomizerFactory implements ContextCustomizerFactory {
4141
@Override
4242
public ContextCustomizer createContextCustomizer(Class<?> testClass,
4343
List<ContextConfigurationAttributes> configAttributes) {
44-
if (MergedAnnotations.from(testClass, SearchStrategy.EXHAUSTIVE).isPresent(Import.class)) {
44+
if (MergedAnnotations.from(testClass, SearchStrategy.TYPE_HIERARCHY).isPresent(Import.class)) {
4545
assertHasNoBeanMethods(testClass);
4646
return new ImportsContextCustomizer(testClass);
4747
}

spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ protected ConfigurableEnvironment getEnvironment() {
151151
* @see SpringApplication#run(String...)
152152
*/
153153
protected String[] getArgs(MergedContextConfiguration config) {
154-
return MergedAnnotations.from(config.getTestClass(), SearchStrategy.EXHAUSTIVE).get(SpringBootTest.class)
154+
return MergedAnnotations.from(config.getTestClass(), SearchStrategy.TYPE_HIERARCHY).get(SpringBootTest.class)
155155
.getValue("args", String[].class).orElse(NO_ARGS);
156156
}
157157

@@ -215,7 +215,7 @@ protected List<ApplicationContextInitializer<?>> getInitializers(MergedContextCo
215215
}
216216

217217
private boolean isEmbeddedWebEnvironment(MergedContextConfiguration config) {
218-
return MergedAnnotations.from(config.getTestClass(), SearchStrategy.EXHAUSTIVE).get(SpringBootTest.class)
218+
return MergedAnnotations.from(config.getTestClass(), SearchStrategy.TYPE_HIERARCHY).get(SpringBootTest.class)
219219
.getValue("webEnvironment", WebEnvironment.class).orElse(WebEnvironment.NONE).isEmbedded();
220220
}
221221

spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextBootstrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ private WebApplicationType deduceWebApplicationType() {
196196
* @since 2.1.6
197197
*/
198198
protected String determineResourceBasePath(MergedContextConfiguration configuration) {
199-
return MergedAnnotations.from(configuration.getTestClass(), SearchStrategy.EXHAUSTIVE)
199+
return MergedAnnotations.from(configuration.getTestClass(), SearchStrategy.TYPE_HIERARCHY)
200200
.get(WebAppConfiguration.class).getValue(MergedAnnotation.VALUE, String.class)
201201
.orElse("src/main/webapp");
202202
}

0 commit comments

Comments
 (0)