Browse Source

Relocate `@PropertyMapping` to spring-boot-test

Move `@PropertyMapping` and supporting code from the
`spring-boot-test-autoconfigure` module to `spring-boot-test`
since it's generally applicable.

See gh-46356
See gh-47322
pull/47381/head
Phillip Webb 3 months ago
parent
commit
17e655b7e5
  1. 28
      core/spring-boot-test/src/main/java/org/springframework/boot/test/context/AnnotationsPropertySource.java
  2. 28
      core/spring-boot-test/src/main/java/org/springframework/boot/test/context/PropertyMapping.java
  3. 2
      core/spring-boot-test/src/main/java/org/springframework/boot/test/context/PropertyMappingContextCustomizer.java
  4. 2
      core/spring-boot-test/src/main/java/org/springframework/boot/test/context/PropertyMappingContextCustomizerFactory.java
  5. 3
      core/spring-boot-test/src/main/java/org/springframework/boot/test/context/package-info.java
  6. 2
      core/spring-boot-test/src/main/resources/META-INF/spring.factories
  7. 17
      core/spring-boot-test/src/test/java/org/springframework/boot/test/context/AnnotationsPropertySourceTests.java
  8. 2
      core/spring-boot-test/src/test/java/org/springframework/boot/test/context/ExampleMapping.java
  9. 2
      core/spring-boot-test/src/test/java/org/springframework/boot/test/context/PropertyMappingContextCustomizerFactoryTests.java
  10. 2
      core/spring-boot-test/src/test/java/org/springframework/boot/test/context/PropertyMappingTests.java
  11. 2
      module/spring-boot-cache-test/src/main/java/org/springframework/boot/cache/test/autoconfigure/AutoConfigureCache.java
  12. 2
      module/spring-boot-data-jpa-test/src/main/java/org/springframework/boot/data/jpa/test/autoconfigure/DataJpaTest.java
  13. 6
      module/spring-boot-jdbc-test/src/main/java/org/springframework/boot/jdbc/test/autoconfigure/AutoConfigureTestDatabase.java
  14. 2
      module/spring-boot-json-test/src/main/java/org/springframework/boot/json/test/autoconfigure/AutoConfigureJsonTesters.java
  15. 2
      module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/autoconfigure/AutoConfigureMockRestServiceServer.java
  16. 2
      module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/autoconfigure/AutoConfigureWebClient.java
  17. 2
      module/spring-boot-restdocs/src/main/java/org/springframework/boot/restdocs/test/autoconfigure/AutoConfigureRestDocs.java
  18. 42
      module/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/SkipPropertyMapping.java
  19. 23
      module/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/package-info.java
  20. 3
      module/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring.factories
  21. 2
      module/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/ExampleTest.java
  22. 2
      module/spring-boot-webflux-test/src/main/java/org/springframework/boot/webflux/test/autoconfigure/AutoConfigureWebTestClient.java
  23. 6
      module/spring-boot-webmvc-test/src/main/java/org/springframework/boot/webmvc/test/autoconfigure/AutoConfigureMockMvc.java
  24. 2
      module/spring-boot-webservices-test/src/main/java/org/springframework/boot/webservices/test/autoconfigure/client/AutoConfigureMockWebServiceServer.java
  25. 2
      module/spring-boot-webservices-test/src/main/java/org/springframework/boot/webservices/test/autoconfigure/client/AutoConfigureWebServiceClient.java

28
module/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java → core/spring-boot-test/src/main/java/org/springframework/boot/test/context/AnnotationsPropertySource.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.test.autoconfigure.properties;
package org.springframework.boot.test.context;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
@ -27,6 +27,7 @@ import java.util.regex.Pattern; @@ -27,6 +27,7 @@ import java.util.regex.Pattern;
import org.jspecify.annotations.Nullable;
import org.springframework.boot.test.context.PropertyMapping.Skip;
import org.springframework.core.annotation.MergedAnnotation;
import org.springframework.core.annotation.MergedAnnotationPredicates;
import org.springframework.core.annotation.MergedAnnotations;
@ -42,19 +43,18 @@ import org.springframework.util.StringUtils; @@ -42,19 +43,18 @@ import org.springframework.util.StringUtils;
*
* @author Phillip Webb
* @author Andy Wilkinson
* @since 1.4.0
*/
public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>> {
class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>> {
private static final Pattern CAMEL_CASE_PATTERN = Pattern.compile("([^A-Z-])([A-Z])");
private final Map<String, Object> properties;
public AnnotationsPropertySource(Class<?> source) {
AnnotationsPropertySource(Class<?> source) {
this("Annotations", source);
}
public AnnotationsPropertySource(String name, Class<?> source) {
AnnotationsPropertySource(String name, Class<?> source) {
super(name, source);
this.properties = getProperties(source);
}
@ -74,8 +74,7 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?> @@ -74,8 +74,7 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
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);
Skip defaultSkip = typeMapping.getValue("skip", Skip.class).orElse(Skip.YES);
for (Method attribute : type.getDeclaredMethods()) {
collectProperties(prefix, defaultSkip, annotation, attribute, properties);
}
@ -85,18 +84,18 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?> @@ -85,18 +84,18 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
}
}
private void collectProperties(String prefix, SkipPropertyMapping skip, MergedAnnotation<?> annotation,
Method attribute, Map<String, Object> properties) {
private void collectProperties(String prefix, Skip skip, MergedAnnotation<?> annotation, Method attribute,
Map<String, Object> properties) {
MergedAnnotation<?> attributeMapping = MergedAnnotations.from(attribute).get(PropertyMapping.class);
skip = attributeMapping.getValue("skip", SkipPropertyMapping.class).orElse(skip);
if (skip == SkipPropertyMapping.YES) {
skip = attributeMapping.getValue("skip", Skip.class).orElse(skip);
if (skip == Skip.YES) {
return;
}
Optional<Object> value = annotation.getValue(attribute.getName());
if (value.isEmpty()) {
return;
}
if (skip == SkipPropertyMapping.ON_DEFAULT_VALUE) {
if (skip == Skip.ON_DEFAULT_VALUE) {
if (ObjectUtils.nullSafeEquals(value.get(), annotation.getDefaultValue(attribute.getName()).orElse(null))) {
return;
}
@ -130,8 +129,7 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?> @@ -130,8 +129,7 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
return postfix;
}
private void putProperties(String name, SkipPropertyMapping defaultSkip, Object value,
Map<String, Object> properties) {
private void putProperties(String name, Skip defaultSkip, Object value, Map<String, Object> properties) {
if (ObjectUtils.isArray(value)) {
Object[] array = ObjectUtils.toObjectArray(value);
for (int i = 0; i < array.length; i++) {
@ -163,7 +161,7 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?> @@ -163,7 +161,7 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
return StringUtils.toStringArray(this.properties.keySet());
}
public boolean isEmpty() {
boolean isEmpty() {
return this.properties.isEmpty();
}

28
module/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/PropertyMapping.java → core/spring-boot-test/src/main/java/org/springframework/boot/test/context/PropertyMapping.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.test.autoconfigure.properties;
package org.springframework.boot.test.context;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
@ -45,7 +45,7 @@ import org.springframework.test.context.TestPropertySource; @@ -45,7 +45,7 @@ import org.springframework.test.context.TestPropertySource;
* <p>
*
* @author Phillip Webb
* @since 1.4.0
* @since 4.0.0
* @see AnnotationsPropertySource
* @see TestPropertySource
*/
@ -68,6 +68,28 @@ public @interface PropertyMapping { @@ -68,6 +68,28 @@ public @interface PropertyMapping {
* overrides the type-level default.
* @return if mapping should be skipped
*/
SkipPropertyMapping skip() default SkipPropertyMapping.NO;
Skip skip() default Skip.NO;
/**
* Controls when mapping is skipped.
*/
enum Skip {
/**
* Skip mapping the property.
*/
YES,
/**
* Skip mapping the property when the default attribute value is specified.
*/
ON_DEFAULT_VALUE,
/**
* Don't skip mapping the property.
*/
NO
}
}

2
module/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizer.java → core/spring-boot-test/src/main/java/org/springframework/boot/test/context/PropertyMappingContextCustomizer.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.test.autoconfigure.properties;
package org.springframework.boot.test.context;
import java.util.Set;
import java.util.stream.Collectors;

2
module/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizerFactory.java → core/spring-boot-test/src/main/java/org/springframework/boot/test/context/PropertyMappingContextCustomizerFactory.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.test.autoconfigure.properties;
package org.springframework.boot.test.context;
import java.util.List;

3
core/spring-boot-test/src/main/java/org/springframework/boot/test/context/package-info.java

@ -15,8 +15,7 @@ @@ -15,8 +15,7 @@
*/
/**
* Classes and annotations related to configuring Spring's {@code ApplicationContext} for
* tests.
* Support for mapping annotation attribute values in the Spring {@code Environment}.
*/
@NullMarked
package org.springframework.boot.test.context;

2
core/spring-boot-test/src/main/resources/META-INF/spring.factories

@ -1,9 +1,11 @@ @@ -1,9 +1,11 @@
# Spring Test Context Customizer Factories
org.springframework.test.context.ContextCustomizerFactory=\
org.springframework.boot.test.context.ImportsContextCustomizerFactory,\
org.springframework.boot.test.context.PropertyMappingContextCustomizerFactory,\
org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizerFactory,\
org.springframework.boot.test.context.filter.annotation.TypeExcludeFiltersContextCustomizerFactory
# Application Context Initializers
org.springframework.context.ApplicationContextInitializer=\
org.springframework.boot.test.context.filter.ExcludeFilterApplicationContextInitializer

17
module/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySourceTests.java → core/spring-boot-test/src/test/java/org/springframework/boot/test/context/AnnotationsPropertySourceTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.test.autoconfigure.properties;
package org.springframework.boot.test.context;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@ -22,10 +22,11 @@ import java.lang.annotation.RetentionPolicy; @@ -22,10 +22,11 @@ import java.lang.annotation.RetentionPolicy;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.autoconfigure.properties.AnnotationsPropertySourceTests.DeeplyNestedAnnotations.Level1;
import org.springframework.boot.test.autoconfigure.properties.AnnotationsPropertySourceTests.DeeplyNestedAnnotations.Level2;
import org.springframework.boot.test.autoconfigure.properties.AnnotationsPropertySourceTests.EnclosingClass.PropertyMappedAnnotationOnEnclosingClass;
import org.springframework.boot.test.autoconfigure.properties.AnnotationsPropertySourceTests.NestedAnnotations.Entry;
import org.springframework.boot.test.context.AnnotationsPropertySourceTests.DeeplyNestedAnnotations.Level1;
import org.springframework.boot.test.context.AnnotationsPropertySourceTests.DeeplyNestedAnnotations.Level2;
import org.springframework.boot.test.context.AnnotationsPropertySourceTests.EnclosingClass.PropertyMappedAnnotationOnEnclosingClass;
import org.springframework.boot.test.context.AnnotationsPropertySourceTests.NestedAnnotations.Entry;
import org.springframework.boot.test.context.PropertyMapping.Skip;
import org.springframework.core.annotation.AliasFor;
import static org.assertj.core.api.Assertions.assertThat;
@ -268,7 +269,7 @@ class AnnotationsPropertySourceTests { @@ -268,7 +269,7 @@ class AnnotationsPropertySourceTests {
}
@Retention(RetentionPolicy.RUNTIME)
@PropertyMapping(skip = SkipPropertyMapping.YES)
@PropertyMapping(skip = Skip.YES)
@interface NotMappedAtTypeLevelAnnotation {
@PropertyMapping
@ -289,7 +290,7 @@ class AnnotationsPropertySourceTests { @@ -289,7 +290,7 @@ class AnnotationsPropertySourceTests {
String value();
@PropertyMapping(skip = SkipPropertyMapping.YES)
@PropertyMapping(skip = Skip.YES)
String ignore() default "xyz";
}
@ -423,7 +424,7 @@ class AnnotationsPropertySourceTests { @@ -423,7 +424,7 @@ class AnnotationsPropertySourceTests {
@PropertyMapping("testenum")
@interface EnumAnnotation {
@PropertyMapping(skip = SkipPropertyMapping.ON_DEFAULT_VALUE)
@PropertyMapping(skip = Skip.ON_DEFAULT_VALUE)
EnumItem value() default EnumItem.DEFAULT;
}

2
module/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/ExampleMapping.java → core/spring-boot-test/src/test/java/org/springframework/boot/test/context/ExampleMapping.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.test.autoconfigure.properties;
package org.springframework.boot.test.context;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

2
module/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizerFactoryTests.java → core/spring-boot-test/src/test/java/org/springframework/boot/test/context/PropertyMappingContextCustomizerFactoryTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.test.autoconfigure.properties;
package org.springframework.boot.test.context;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

2
module/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingTests.java → core/spring-boot-test/src/test/java/org/springframework/boot/test/context/PropertyMappingTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.test.autoconfigure.properties;
package org.springframework.boot.test.context;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

2
module/spring-boot-cache-test/src/main/java/org/springframework/boot/cache/test/autoconfigure/AutoConfigureCache.java vendored

@ -25,7 +25,7 @@ import java.lang.annotation.Target; @@ -25,7 +25,7 @@ import java.lang.annotation.Target;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.cache.CacheType;
import org.springframework.boot.test.autoconfigure.properties.PropertyMapping;
import org.springframework.boot.test.context.PropertyMapping;
import org.springframework.cache.CacheManager;
import org.springframework.cache.support.NoOpCacheManager;

2
module/spring-boot-data-jpa-test/src/main/java/org/springframework/boot/data/jpa/test/autoconfigure/DataJpaTest.java

@ -31,7 +31,7 @@ import org.springframework.boot.jdbc.test.autoconfigure.AutoConfigureJdbc; @@ -31,7 +31,7 @@ import org.springframework.boot.jdbc.test.autoconfigure.AutoConfigureJdbc;
import org.springframework.boot.jdbc.test.autoconfigure.AutoConfigureTestDatabase;
import org.springframework.boot.jpa.test.autoconfigure.AutoConfigureTestEntityManager;
import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration;
import org.springframework.boot.test.autoconfigure.properties.PropertyMapping;
import org.springframework.boot.test.context.PropertyMapping;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.filter.annotation.TypeExcludeFilters;
import org.springframework.context.annotation.ComponentScan.Filter;

6
module/spring-boot-jdbc-test/src/main/java/org/springframework/boot/jdbc/test/autoconfigure/AutoConfigureTestDatabase.java

@ -28,8 +28,8 @@ import javax.sql.DataSource; @@ -28,8 +28,8 @@ import javax.sql.DataSource;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.container.ContainerImageMetadata;
import org.springframework.boot.jdbc.EmbeddedDatabaseConnection;
import org.springframework.boot.test.autoconfigure.properties.PropertyMapping;
import org.springframework.boot.test.autoconfigure.properties.SkipPropertyMapping;
import org.springframework.boot.test.context.PropertyMapping;
import org.springframework.boot.test.context.PropertyMapping.Skip;
import org.springframework.context.annotation.Primary;
import org.springframework.test.context.DynamicPropertySource;
@ -55,7 +55,7 @@ public @interface AutoConfigureTestDatabase { @@ -55,7 +55,7 @@ public @interface AutoConfigureTestDatabase {
* Determines what type of existing DataSource bean can be replaced.
* @return the type of existing DataSource to replace
*/
@PropertyMapping(skip = SkipPropertyMapping.ON_DEFAULT_VALUE)
@PropertyMapping(skip = Skip.ON_DEFAULT_VALUE)
Replace replace() default Replace.NON_TEST;
/**

2
module/spring-boot-json-test/src/main/java/org/springframework/boot/json/test/autoconfigure/AutoConfigureJsonTesters.java

@ -28,7 +28,7 @@ import org.springframework.boot.json.test.BasicJsonTester; @@ -28,7 +28,7 @@ import org.springframework.boot.json.test.BasicJsonTester;
import org.springframework.boot.json.test.GsonTester;
import org.springframework.boot.json.test.JacksonTester;
import org.springframework.boot.json.test.JsonbTester;
import org.springframework.boot.test.autoconfigure.properties.PropertyMapping;
import org.springframework.boot.test.context.PropertyMapping;
/**
* Annotation that can be applied to a test class to enable and configure

2
module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/autoconfigure/AutoConfigureMockRestServiceServer.java

@ -27,7 +27,7 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration; @@ -27,7 +27,7 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.restclient.RestTemplateBuilder;
import org.springframework.boot.restclient.test.MockServerRestClientCustomizer;
import org.springframework.boot.restclient.test.MockServerRestTemplateCustomizer;
import org.springframework.boot.test.autoconfigure.properties.PropertyMapping;
import org.springframework.boot.test.context.PropertyMapping;
import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.web.client.RestClient.Builder;

2
module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/autoconfigure/AutoConfigureWebClient.java

@ -26,7 +26,7 @@ import java.lang.annotation.Target; @@ -26,7 +26,7 @@ import java.lang.annotation.Target;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.json.test.autoconfigure.AutoConfigureJson;
import org.springframework.boot.restclient.RestTemplateBuilder;
import org.springframework.boot.test.autoconfigure.properties.PropertyMapping;
import org.springframework.boot.test.context.PropertyMapping;
import org.springframework.web.client.RestTemplate;
/**

2
module/spring-boot-restdocs/src/main/java/org/springframework/boot/restdocs/test/autoconfigure/AutoConfigureRestDocs.java

@ -26,7 +26,7 @@ import java.lang.annotation.Target; @@ -26,7 +26,7 @@ import java.lang.annotation.Target;
import io.restassured.RestAssured;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.test.autoconfigure.properties.PropertyMapping;
import org.springframework.boot.test.context.PropertyMapping;
import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.AliasFor;
import org.springframework.test.web.reactive.server.WebTestClient;

42
module/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/SkipPropertyMapping.java

@ -1,42 +0,0 @@ @@ -1,42 +0,0 @@
/*
* Copyright 2012-present 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.test.autoconfigure.properties;
/**
* Enum used to control when {@link PropertyMapping @PropertyMapping} is skipped.
*
* @author Phillip Webb
* @since 1.4.0
*/
public enum SkipPropertyMapping {
/**
* Skip mapping the property.
*/
YES,
/**
* Skip mapping the property when the default attribute value is specified.
*/
ON_DEFAULT_VALUE,
/**
* Don't skip mapping the property.
*/
NO
}

23
module/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/package-info.java

@ -1,23 +0,0 @@ @@ -1,23 +0,0 @@
/*
* Copyright 2012-present 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Support for mapping annotation attribute values in the Spring {@code Environment}.
*/
@NullMarked
package org.springframework.boot.test.autoconfigure.properties;
import org.jspecify.annotations.NullMarked;

3
module/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring.factories

@ -1,5 +1,4 @@ @@ -1,5 +1,4 @@
# Spring Test Context Customizer Factories
org.springframework.test.context.ContextCustomizerFactory=\
org.springframework.boot.test.autoconfigure.OnFailureConditionReportContextCustomizerFactory,\
org.springframework.boot.test.autoconfigure.OverrideAutoConfigurationContextCustomizerFactory,\
org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizerFactory
org.springframework.boot.test.autoconfigure.OverrideAutoConfigurationContextCustomizerFactory

2
module/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/ExampleTest.java

@ -26,7 +26,7 @@ import java.lang.annotation.Target; @@ -26,7 +26,7 @@ import java.lang.annotation.Target;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.test.autoconfigure.properties.PropertyMapping;
import org.springframework.boot.test.context.PropertyMapping;
import org.springframework.test.context.BootstrapWith;
import org.springframework.test.context.junit.jupiter.SpringExtension;

2
module/spring-boot-webflux-test/src/main/java/org/springframework/boot/webflux/test/autoconfigure/AutoConfigureWebTestClient.java

@ -25,7 +25,7 @@ import java.lang.annotation.Target; @@ -25,7 +25,7 @@ import java.lang.annotation.Target;
import java.time.Duration;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.test.autoconfigure.properties.PropertyMapping;
import org.springframework.boot.test.context.PropertyMapping;
import org.springframework.context.ApplicationContext;
import org.springframework.test.web.reactive.server.WebTestClient;

6
module/spring-boot-webmvc-test/src/main/java/org/springframework/boot/webmvc/test/autoconfigure/AutoConfigureMockMvc.java

@ -27,8 +27,8 @@ import org.htmlunit.WebClient; @@ -27,8 +27,8 @@ import org.htmlunit.WebClient;
import org.openqa.selenium.WebDriver;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.test.autoconfigure.properties.PropertyMapping;
import org.springframework.boot.test.autoconfigure.properties.SkipPropertyMapping;
import org.springframework.boot.test.context.PropertyMapping;
import org.springframework.boot.test.context.PropertyMapping.Skip;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.assertj.MockMvcTester;
@ -62,7 +62,7 @@ public @interface AutoConfigureMockMvc { @@ -62,7 +62,7 @@ public @interface AutoConfigureMockMvc {
* How {@link MvcResult} information should be printed after each MockMVC invocation.
* @return how information is printed
*/
@PropertyMapping(skip = SkipPropertyMapping.ON_DEFAULT_VALUE)
@PropertyMapping(skip = Skip.ON_DEFAULT_VALUE)
MockMvcPrint print() default MockMvcPrint.DEFAULT;
/**

2
module/spring-boot-webservices-test/src/main/java/org/springframework/boot/webservices/test/autoconfigure/client/AutoConfigureMockWebServiceServer.java

@ -24,7 +24,7 @@ import java.lang.annotation.RetentionPolicy; @@ -24,7 +24,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.test.autoconfigure.properties.PropertyMapping;
import org.springframework.boot.test.context.PropertyMapping;
import org.springframework.ws.test.client.MockWebServiceServer;
/**

2
module/spring-boot-webservices-test/src/main/java/org/springframework/boot/webservices/test/autoconfigure/client/AutoConfigureWebServiceClient.java

@ -24,7 +24,7 @@ import java.lang.annotation.RetentionPolicy; @@ -24,7 +24,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.test.autoconfigure.properties.PropertyMapping;
import org.springframework.boot.test.context.PropertyMapping;
import org.springframework.boot.webservices.client.WebServiceTemplateBuilder;
import org.springframework.ws.client.core.WebServiceTemplate;

Loading…
Cancel
Save