Merge branch '2.7.x' into 3.0.x

This commit is contained in:
Phillip Webb
2023-02-21 23:15:40 -08:00
1890 changed files with 27173 additions and 21952 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -82,8 +82,10 @@ class ObservabilityContextCustomizerFactory implements ContextCustomizerFactory
public void customizeContext(ConfigurableApplicationContext context,
MergedContextConfiguration mergedContextConfiguration) {
if (this.disableMetrics) {
TestPropertyValues.of("management.defaults.metrics.export.enabled=false",
"management.simple.metrics.export.enabled=true").applyTo(context);
TestPropertyValues
.of("management.defaults.metrics.export.enabled=false",
"management.simple.metrics.export.enabled=true")
.applyTo(context);
}
if (this.disableTracing) {
TestPropertyValues.of("management.tracing.enabled=false").applyTo(context);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,8 +31,10 @@ class DataCassandraTestContextBootstrapper extends SpringBootTestContextBootstra
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataCassandraTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(DataCassandraTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,8 +31,10 @@ class DataCouchbaseTestContextBootstrapper extends SpringBootTestContextBootstra
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataCouchbaseTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(DataCouchbaseTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,8 +31,10 @@ class DataElasticsearchTestContextBootstrapper extends SpringBootTestContextBoot
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataElasticsearchTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(DataElasticsearchTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,8 +30,10 @@ class DataJdbcTestContextBootstrapper extends SpringBootTestContextBootstrapper
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataJdbcTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(DataJdbcTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,8 +30,10 @@ class DataLdapTestContextBootstrapper extends SpringBootTestContextBootstrapper
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataLdapTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(DataLdapTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,8 +30,10 @@ class DataMongoTestContextBootstrapper extends SpringBootTestContextBootstrapper
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataMongoTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(DataMongoTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,8 +30,10 @@ class DataNeo4jTestContextBootstrapper extends SpringBootTestContextBootstrapper
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataNeo4jTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(DataNeo4jTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,8 +30,10 @@ class DataR2dbcTestContextBootstrapper extends SpringBootTestContextBootstrapper
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataR2dbcTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(DataR2dbcTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,8 +30,10 @@ class DataRedisTestContextBootstrapper extends SpringBootTestContextBootstrapper
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataRedisTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(DataRedisTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@ public abstract class StandardAnnotationCustomizableTypeExcludeFilter<A extends
protected StandardAnnotationCustomizableTypeExcludeFilter(Class<?> testClass) {
this.annotation = MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(getAnnotationType());
.get(getAnnotationType());
}
protected final MergedAnnotation<A> getAnnotation() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@ class TypeExcludeFiltersContextCustomizerFactory implements ContextCustomizerFac
return null;
}
AnnotationDescriptor<TypeExcludeFilters> descriptor = TestContextAnnotationUtils
.findAnnotationDescriptor(testClass, TypeExcludeFilters.class);
.findAnnotationDescriptor(testClass, TypeExcludeFilters.class);
Class<?>[] filterClasses = (descriptor != null) ? descriptor.getAnnotation().value() : NO_FILTERS;
if (ObjectUtils.isEmpty(filterClasses)) {
return null;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 the original author or authors.
* Copyright 2020-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,9 @@ class GraphQlTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, MergedAnnotations.SearchStrategy.INHERITED_ANNOTATIONS)
.get(GraphQlTest.class).getValue("properties", String[].class).orElse(null);
.get(GraphQlTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,8 +30,10 @@ class JdbcTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(JdbcTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(JdbcTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,8 +30,10 @@ class JooqTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(JooqTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(JooqTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,8 +30,10 @@ class JsonTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(JsonTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(JsonTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,8 +30,10 @@ class DataJpaTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(DataJpaTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(DataJpaTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -64,18 +64,20 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
}
private void getProperties(Class<?> source, Map<String, Object> properties) {
MergedAnnotations.from(source, SearchStrategy.SUPERCLASS).stream()
.filter(MergedAnnotationPredicates.unique(MergedAnnotation::getType)).forEach((annotation) -> {
Class<Annotation> type = annotation.getType();
MergedAnnotation<?> typeMapping = MergedAnnotations.from(type).get(PropertyMapping.class,
MergedAnnotation::isDirectlyPresent);
String prefix = typeMapping.getValue(MergedAnnotation.VALUE, String.class).orElse("");
SkipPropertyMapping defaultSkip = typeMapping.getValue("skip", SkipPropertyMapping.class)
.orElse(SkipPropertyMapping.YES);
for (Method attribute : type.getDeclaredMethods()) {
collectProperties(prefix, defaultSkip, annotation, attribute, properties);
}
});
MergedAnnotations.from(source, SearchStrategy.SUPERCLASS)
.stream()
.filter(MergedAnnotationPredicates.unique(MergedAnnotation::getType))
.forEach((annotation) -> {
Class<Annotation> type = annotation.getType();
MergedAnnotation<?> typeMapping = MergedAnnotations.from(type)
.get(PropertyMapping.class, MergedAnnotation::isDirectlyPresent);
String prefix = typeMapping.getValue(MergedAnnotation.VALUE, String.class).orElse("");
SkipPropertyMapping defaultSkip = typeMapping.getValue("skip", SkipPropertyMapping.class)
.orElse(SkipPropertyMapping.YES);
for (Method attribute : type.getDeclaredMethods()) {
collectProperties(prefix, defaultSkip, annotation, attribute, properties);
}
});
if (TestContextAnnotationUtils.searchEnclosingClass(source)) {
getProperties(source.getEnclosingClass(), properties);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,8 +51,9 @@ class PropertyMappingContextCustomizer implements ContextCustomizer {
if (!this.propertySource.isEmpty()) {
context.getEnvironment().getPropertySources().addFirst(this.propertySource);
}
context.getBeanFactory().registerSingleton(PropertyMappingCheckBeanPostProcessor.class.getName(),
new PropertyMappingCheckBeanPostProcessor());
context.getBeanFactory()
.registerSingleton(PropertyMappingCheckBeanPostProcessor.class.getName(),
new PropertyMappingCheckBeanPostProcessor());
}
@Override
@@ -76,10 +77,12 @@ class PropertyMappingContextCustomizer implements ContextCustomizer {
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
Class<?> beanClass = bean.getClass();
MergedAnnotations annotations = MergedAnnotations.from(beanClass, SearchStrategy.SUPERCLASS);
Set<Class<?>> components = annotations.stream(Component.class).map(this::getRoot)
.collect(Collectors.toSet());
Set<Class<?>> propertyMappings = annotations.stream(PropertyMapping.class).map(this::getRoot)
.collect(Collectors.toSet());
Set<Class<?>> components = annotations.stream(Component.class)
.map(this::getRoot)
.collect(Collectors.toSet());
Set<Class<?>> propertyMappings = annotations.stream(PropertyMapping.class)
.map(this::getRoot)
.collect(Collectors.toSet());
if (!components.isEmpty() && !propertyMappings.isEmpty()) {
throw new IllegalStateException("The @PropertyMapping " + getAnnotationsDescription(propertyMappings)
+ " cannot be used in combination with the @Component "

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,9 +62,9 @@ public class RestDocsAutoConfiguration {
ObjectProvider<RestDocsMockMvcConfigurationCustomizer> configurationCustomizers,
RestDocumentationContextProvider contextProvider) {
MockMvcRestDocumentationConfigurer configurer = MockMvcRestDocumentation
.documentationConfiguration(contextProvider);
.documentationConfiguration(contextProvider);
configurationCustomizers.orderedStream()
.forEach((configurationCustomizer) -> configurationCustomizer.customize(configurer));
.forEach((configurationCustomizer) -> configurationCustomizer.customize(configurer));
return configurer;
}
@@ -88,9 +88,9 @@ public class RestDocsAutoConfiguration {
ObjectProvider<RestDocsRestAssuredConfigurationCustomizer> configurationCustomizers,
RestDocumentationContextProvider contextProvider) {
RestAssuredRestDocumentationConfigurer configurer = RestAssuredRestDocumentation
.documentationConfiguration(contextProvider);
.documentationConfiguration(contextProvider);
configurationCustomizers.orderedStream()
.forEach((configurationCustomizer) -> configurationCustomizer.customize(configurer));
.forEach((configurationCustomizer) -> configurationCustomizer.customize(configurer));
return new RequestSpecBuilder().addFilter(configurer).build();
}
@@ -114,9 +114,9 @@ public class RestDocsAutoConfiguration {
ObjectProvider<RestDocsWebTestClientConfigurationCustomizer> configurationCustomizers,
RestDocumentationContextProvider contextProvider) {
WebTestClientRestDocumentationConfigurer configurer = WebTestClientRestDocumentation
.documentationConfiguration(contextProvider);
.documentationConfiguration(contextProvider);
configurationCustomizers.orderedStream()
.forEach((configurationCustomizer) -> configurationCustomizer.customize(configurer));
.forEach((configurationCustomizer) -> configurationCustomizer.customize(configurer));
return configurer;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,8 +43,8 @@ class RestDocsRestAssuredBuilderCustomizer implements InitializingBean {
PropertyMapper map = PropertyMapper.get();
String host = this.properties.getUriHost();
map.from(this.properties::getUriScheme)
.when((scheme) -> StringUtils.hasText(scheme) && StringUtils.hasText(host))
.to((scheme) -> this.delegate.baseUri(scheme + "://" + host));
.when((scheme) -> StringUtils.hasText(scheme) && StringUtils.hasText(host))
.to((scheme) -> this.delegate.baseUri(scheme + "://" + host));
map.from(this.properties::getUriPort).whenNonNull().to(this.delegate::port);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,9 +37,9 @@ class RestDocumentationContextProviderRegistrar implements ImportBeanDefinitionR
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
Map<String, Object> annotationAttributes = importingClassMetadata
.getAnnotationAttributes(AutoConfigureRestDocs.class.getName());
.getAnnotationAttributes(AutoConfigureRestDocs.class.getName());
BeanDefinitionBuilder definitionBuilder = BeanDefinitionBuilder
.genericBeanDefinition(ManualRestDocumentation.class);
.genericBeanDefinition(ManualRestDocumentation.class);
String outputDir = (String) annotationAttributes.get("outputDir");
if (StringUtils.hasText(outputDir)) {
definitionBuilder.addConstructorArgValue(outputDir);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -64,7 +64,7 @@ public class MockRestServiceServerAutoConfiguration {
private MockRestServiceServer createDeferredMockRestServiceServer(MockServerRestTemplateCustomizer customizer)
throws Exception {
Constructor<MockRestServiceServer> constructor = MockRestServiceServer.class
.getDeclaredConstructor(RequestExpectationManager.class);
.getDeclaredConstructor(RequestExpectationManager.class);
constructor.setAccessible(true);
return constructor.newInstance(new DeferredRequestExpectationManager(customizer));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,8 +30,10 @@ class RestClientTestContextBootstrapper extends SpringBootTestContextBootstrappe
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(RestClientTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(RestClientTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,8 +38,10 @@ class WebFluxTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(WebFluxTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(WebFluxTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -132,7 +132,7 @@ public class MockMvcAutoConfiguration {
dispatcherServlet.setDispatchOptionsRequest(this.webMvcProperties.isDispatchOptionsRequest());
dispatcherServlet.setDispatchTraceRequest(this.webMvcProperties.isDispatchTraceRequest());
dispatcherServlet
.setThrowExceptionIfNoHandlerFound(this.webMvcProperties.isThrowExceptionIfNoHandlerFound());
.setThrowExceptionIfNoHandlerFound(this.webMvcProperties.isThrowExceptionIfNoHandlerFound());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@ public class MockMvcWebDriverAutoConfiguration {
@ConditionalOnBean(MockMvc.class)
public MockMvcHtmlUnitDriverBuilder mockMvcHtmlUnitDriverBuilder(MockMvc mockMvc, Environment environment) {
return MockMvcHtmlUnitDriverBuilder.mockMvcSetup(mockMvc)
.withDelegate(new LocalHostWebConnectionHtmlUnitDriver(environment, BrowserVersion.CHROME));
.withDelegate(new LocalHostWebConnectionHtmlUnitDriver(environment, BrowserVersion.CHROME));
}
@Bean

View File

@@ -107,9 +107,10 @@ public class SpringBootMockMvcBuilderCustomizer implements MockMvcBuilderCustomi
private void addFilters(ConfigurableMockMvcBuilder<?> builder) {
FilterRegistrationBeans registrations = new FilterRegistrationBeans(this.context);
registrations.stream().map(AbstractFilterRegistrationBean.class::cast)
.filter(AbstractFilterRegistrationBean<?>::isEnabled)
.forEach((registration) -> addFilter(builder, registration));
registrations.stream()
.map(AbstractFilterRegistrationBean.class::cast)
.filter(AbstractFilterRegistrationBean<?>::isEnabled)
.forEach((registration) -> addFilter(builder, registration));
}
private void addFilter(ConfigurableMockMvcBuilder<?> builder, AbstractFilterRegistrationBean<?> registration) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,8 +40,10 @@ class WebMvcTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(WebMvcTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(WebMvcTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,8 +31,10 @@ class WebServiceClientTestContextBootstrapper extends SpringBootTestContextBoots
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(WebServiceClientTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(WebServiceClientTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,8 +39,10 @@ class WebServiceServerTestContextBootstrapper extends SpringBootTestContextBoots
@Override
protected String[] getProperties(Class<?> testClass) {
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).get(WebServiceServerTest.class)
.getValue("properties", String[].class).orElse(null);
return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS)
.get(WebServiceServerTest.class)
.getValue("properties", String[].class)
.orElse(null);
}
}