diff --git a/config/checkstyle/checkstyle-suppressions.xml b/config/checkstyle/checkstyle-suppressions.xml index 60923df61f7..1eebdbcdb78 100644 --- a/config/checkstyle/checkstyle-suppressions.xml +++ b/config/checkstyle/checkstyle-suppressions.xml @@ -29,6 +29,7 @@ + diff --git a/core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java b/core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java index fd04817c106..c8d11f22b80 100644 --- a/core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java +++ b/core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java @@ -442,7 +442,7 @@ public final class ConditionMessage { return result; } - protected abstract @Nullable Object applyToItem(@Nullable Object item); + abstract @Nullable Object applyToItem(@Nullable Object item); } diff --git a/core/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiElement.java b/core/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiElement.java index bd5e3b08b7a..fd6b9997045 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiElement.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiElement.java @@ -25,6 +25,7 @@ package org.springframework.boot.ansi; public interface AnsiElement { /** + * Return the ANSI escape code. * @return the ANSI escape code */ @Override diff --git a/core/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiOutput.java b/core/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiOutput.java index 22f7afffd10..31a26bdda2b 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiOutput.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiOutput.java @@ -61,7 +61,7 @@ public abstract class AnsiOutput { } /** - * Returns if ANSI output is enabled + * Returns if ANSI output is enabled. * @return if ANSI enabled, disabled or detected */ public static Enabled getEnabled() { diff --git a/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataProperties.java b/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataProperties.java index a9f74cdc47d..94c1b03ff51 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataProperties.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataProperties.java @@ -52,7 +52,7 @@ class ConfigDataProperties { * @param imports the imports requested * @param activate the activate properties */ - ConfigDataProperties(@Nullable @Name("import") List imports, @Nullable Activate activate) { + ConfigDataProperties(@Name("import") @Nullable List imports, @Nullable Activate activate) { this.imports = (imports != null) ? imports.stream().filter(ConfigDataLocation::isNotEmpty).toList() : Collections.emptyList(); this.activate = activate; diff --git a/core/spring-boot/src/main/java/org/springframework/boot/support/ReflectionEnvironmentPostProcessorsFactory.java b/core/spring-boot/src/main/java/org/springframework/boot/support/ReflectionEnvironmentPostProcessorsFactory.java index 0f1055a14f4..4146a2abf23 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/support/ReflectionEnvironmentPostProcessorsFactory.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/support/ReflectionEnvironmentPostProcessorsFactory.java @@ -43,7 +43,7 @@ class ReflectionEnvironmentPostProcessorsFactory implements EnvironmentPostProce private @Nullable ClassLoader classLoader; - private @Nullable final List classNames; + private final @Nullable List classNames; ReflectionEnvironmentPostProcessorsFactory(Class... classes) { this.classes = new ArrayList<>(Arrays.asList(classes)); diff --git a/core/spring-boot/src/main/java/org/springframework/boot/support/SystemEnvironmentPropertySourceEnvironmentPostProcessor.java b/core/spring-boot/src/main/java/org/springframework/boot/support/SystemEnvironmentPropertySourceEnvironmentPostProcessor.java index 2a2fb7b3354..90bbb55da10 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/support/SystemEnvironmentPropertySourceEnvironmentPostProcessor.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/support/SystemEnvironmentPropertySourceEnvironmentPostProcessor.java @@ -88,7 +88,6 @@ public class SystemEnvironmentPropertySourceEnvironmentPostProcessor implements * settings from a parent {@link ConfigurableEnvironment}. * @param environment the environment to post-process * @param parentEnvironment the parent environment - * @since 3.4.12 */ public static void postProcessEnvironment(ConfigurableEnvironment environment, ConfigurableEnvironment parentEnvironment) { diff --git a/core/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/JavaBeanBinderTests.java b/core/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/JavaBeanBinderTests.java index eece843ebd7..fe298c08b4a 100644 --- a/core/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/JavaBeanBinderTests.java +++ b/core/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/JavaBeanBinderTests.java @@ -42,6 +42,7 @@ import org.springframework.boot.convert.Delimiter; import org.springframework.core.ResolvableType; import org.springframework.core.convert.ConversionService; import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.format.annotation.DateTimeFormat.ISO; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -1062,7 +1063,7 @@ class JavaBeanBinderTests { static class ConverterAnnotatedExampleBean { - @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) + @DateTimeFormat(iso = ISO.DATE) private @Nullable LocalDate date; @Nullable LocalDate getDate() { diff --git a/core/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java b/core/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java index 2f1d0bd3b4b..273e625f915 100644 --- a/core/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java +++ b/core/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java @@ -38,6 +38,7 @@ import org.springframework.core.DefaultParameterNameDiscoverer; import org.springframework.core.ResolvableType; import org.springframework.core.convert.ConversionService; import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.format.annotation.DateTimeFormat.ISO; import org.springframework.util.Assert; import static org.assertj.core.api.Assertions.assertThat; @@ -623,8 +624,8 @@ class ValueObjectBinderTests { private final String bar; - ConverterAnnotatedExampleBean( - @DefaultValue("2019-05-10") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, String bar) { + ConverterAnnotatedExampleBean(@DefaultValue("2019-05-10") @DateTimeFormat(iso = ISO.DATE) LocalDate date, + String bar) { this.date = date; this.bar = bar; } diff --git a/gradle.properties b/gradle.properties index e75ee94c8d7..a60af8800fc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ graalVersion=25 hamcrestVersion=3.0 jackson2Version=2.21.5 jacksonVersion=3.1.5 -javaFormatVersion=0.0.47 +javaFormatVersion=0.0.48 junitJupiterVersion=6.0.3 kotlinVersion=2.2.21 mavenVersion=3.9.13 diff --git a/module/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/ShutdownEndpoint.java b/module/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/ShutdownEndpoint.java index 4c61cfcc088..2d7eeb297fb 100644 --- a/module/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/ShutdownEndpoint.java +++ b/module/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/ShutdownEndpoint.java @@ -39,7 +39,7 @@ import org.springframework.util.Assert; @Endpoint(id = "shutdown", defaultAccess = Access.NONE) public class ShutdownEndpoint implements ApplicationContextAware { - @Nullable private ConfigurableApplicationContext context; + private @Nullable ConfigurableApplicationContext context; @WriteOperation public ShutdownDescriptor shutdown() { diff --git a/module/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/env/EnvironmentEndpoint.java b/module/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/env/EnvironmentEndpoint.java index 807ceb0761b..c4a0fdcc535 100644 --- a/module/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/env/EnvironmentEndpoint.java +++ b/module/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/env/EnvironmentEndpoint.java @@ -27,6 +27,7 @@ import java.util.regex.PatternSyntaxException; import java.util.stream.Stream; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import org.jspecify.annotations.Nullable; import org.springframework.boot.actuate.endpoint.InvalidEndpointRequestException; @@ -252,7 +253,7 @@ public class EnvironmentEndpoint { /** * Description of an entry of the {@link Environment}. */ - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(Include.NON_NULL) public static final class EnvironmentEntryDescriptor { private final @Nullable PropertySummaryDescriptor property; @@ -292,7 +293,7 @@ public class EnvironmentEndpoint { /** * Description of a particular entry of the {@link Environment}. */ - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(Include.NON_NULL) public static final class PropertySummaryDescriptor { private final String source; @@ -341,7 +342,7 @@ public class EnvironmentEndpoint { /** * Description of a particular entry of {@link PropertySource}. */ - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(Include.NON_NULL) public static final class PropertySourceEntryDescriptor { private final String name; @@ -366,7 +367,7 @@ public class EnvironmentEndpoint { /** * Description of a property's value, including its origin if available. */ - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(Include.NON_NULL) public static final class PropertyValueDescriptor { private final @Nullable Object value; diff --git a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/AbstractDevToolsIntegrationTests.java b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/AbstractDevToolsIntegrationTests.java index 0a3f8607d18..d564a4816ab 100644 --- a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/AbstractDevToolsIntegrationTests.java +++ b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/AbstractDevToolsIntegrationTests.java @@ -101,12 +101,12 @@ abstract class AbstractDevToolsIntegrationTests { this.classesDirectory = classesDirectory; } - protected ControllerBuilder withRequestMapping(String mapping) { + ControllerBuilder withRequestMapping(String mapping) { this.mappings.add(mapping); return this; } - protected void build() throws Exception { + void build() throws Exception { DynamicType.Builder builder = new ByteBuddy().subclass(Object.class) .name(this.name) .annotateType(AnnotationDescription.Builder.ofType(RestController.class).build()); diff --git a/module/spring-boot-health/src/main/java/org/springframework/boot/health/autoconfigure/application/package-info.java b/module/spring-boot-health/src/main/java/org/springframework/boot/health/autoconfigure/application/package-info.java index 7b96c89b61e..17fa2b635b7 100644 --- a/module/spring-boot-health/src/main/java/org/springframework/boot/health/autoconfigure/application/package-info.java +++ b/module/spring-boot-health/src/main/java/org/springframework/boot/health/autoconfigure/application/package-info.java @@ -14,6 +14,9 @@ * limitations under the License. */ +/** + * Auto-configuration for application health indicators. + */ @NullMarked package org.springframework.boot.health.autoconfigure.application; diff --git a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/JacksonComponentModuleTests.java b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/JacksonComponentModuleTests.java index 06be782b0f8..bb7694d3e5c 100644 --- a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/JacksonComponentModuleTests.java +++ b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/JacksonComponentModuleTests.java @@ -34,6 +34,7 @@ import org.springframework.aot.test.generate.TestGenerationContext; import org.springframework.beans.factory.aot.BeanFactoryInitializationAotContribution; import org.springframework.beans.factory.aot.BeanFactoryInitializationCode; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.boot.jackson.JacksonComponent.Scope; import org.springframework.boot.jackson.JacksonComponentModule.JacksonComponentBeanFactoryInitializationAotProcessor; import org.springframework.boot.jackson.JacksonComponentModuleTests.ComponentWithInnerAbstractClass.AbstractSerializer; import org.springframework.boot.jackson.JacksonComponentModuleTests.ComponentWithInnerAbstractClass.ConcreteSerializer; @@ -236,12 +237,12 @@ class JacksonComponentModuleTests { } - @JacksonComponent(scope = JacksonComponent.Scope.KEYS) + @JacksonComponent(scope = Scope.KEYS) static class OnlyKeySerializer extends NameAndAgeJacksonKeyComponent.Serializer { } - @JacksonComponent(scope = JacksonComponent.Scope.KEYS, type = NameAndAge.class) + @JacksonComponent(scope = Scope.KEYS, type = NameAndAge.class) static class OnlyKeyDeserializer extends NameAndAgeJacksonKeyComponent.Deserializer { } diff --git a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/NameAndAgeJacksonKeyComponent.java b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/NameAndAgeJacksonKeyComponent.java index c4b24a8ee0a..eac257adf64 100644 --- a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/NameAndAgeJacksonKeyComponent.java +++ b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/NameAndAgeJacksonKeyComponent.java @@ -22,6 +22,7 @@ import tools.jackson.databind.KeyDeserializer; import tools.jackson.databind.SerializationContext; import tools.jackson.databind.ValueSerializer; +import org.springframework.boot.jackson.JacksonComponent.Scope; import org.springframework.boot.jackson.types.NameAndAge; /** @@ -29,7 +30,7 @@ import org.springframework.boot.jackson.types.NameAndAge; * * @author Paul Aly */ -@JacksonComponent(type = NameAndAge.class, scope = JacksonComponent.Scope.KEYS) +@JacksonComponent(type = NameAndAge.class, scope = Scope.KEYS) public class NameAndAgeJacksonKeyComponent { static class Serializer extends ValueSerializer { diff --git a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/JsonComponentModuleTests.java b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/JsonComponentModuleTests.java index ac22fd37a03..4ad2b4b2fc7 100644 --- a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/JsonComponentModuleTests.java +++ b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/JsonComponentModuleTests.java @@ -58,6 +58,7 @@ class JsonComponentModuleTests { private @Nullable AnnotationConfigApplicationContext context; + @Deprecated(since = "4.0.0", forRemoval = true) @AfterEach void closeContext() { if (this.context != null) { @@ -65,6 +66,7 @@ class JsonComponentModuleTests { } } + @Deprecated(since = "4.0.0", forRemoval = true) @Test void moduleShouldRegisterSerializers() throws Exception { load(OnlySerializer.class); @@ -72,6 +74,7 @@ class JsonComponentModuleTests { assertSerialize(module); } + @Deprecated(since = "4.0.0", forRemoval = true) @Test void moduleShouldRegisterDeserializers() throws Exception { load(OnlyDeserializer.class); @@ -79,6 +82,7 @@ class JsonComponentModuleTests { assertDeserialize(module); } + @Deprecated(since = "4.0.0", forRemoval = true) @Test void moduleShouldRegisterInnerClasses() throws Exception { load(NameAndAgeJsonComponent.class); @@ -87,6 +91,7 @@ class JsonComponentModuleTests { assertDeserialize(module); } + @Deprecated(since = "4.0.0", forRemoval = true) @Test void moduleShouldAllowInnerAbstractClasses() throws Exception { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(JsonComponentModule.class, @@ -96,6 +101,7 @@ class JsonComponentModuleTests { context.close(); } + @Deprecated(since = "4.0.0", forRemoval = true) @Test void moduleShouldRegisterKeySerializers() throws Exception { load(OnlyKeySerializer.class); @@ -103,6 +109,7 @@ class JsonComponentModuleTests { assertKeySerialize(module); } + @Deprecated(since = "4.0.0", forRemoval = true) @Test void moduleShouldRegisterKeyDeserializers() throws Exception { load(OnlyKeyDeserializer.class); @@ -110,6 +117,7 @@ class JsonComponentModuleTests { assertKeyDeserialize(module); } + @Deprecated(since = "4.0.0", forRemoval = true) @Test void moduleShouldRegisterInnerClassesForKeyHandlers() throws Exception { load(NameAndAgeJsonKeyComponent.class); @@ -118,6 +126,7 @@ class JsonComponentModuleTests { assertKeyDeserialize(module); } + @Deprecated(since = "4.0.0", forRemoval = true) @Test void moduleShouldRegisterOnlyForSpecifiedClasses() throws Exception { load(NameAndCareerJsonComponent.class); @@ -127,6 +136,7 @@ class JsonComponentModuleTests { assertDeserializeForSpecifiedClasses(module); } + @Deprecated(since = "4.0.0", forRemoval = true) @Test void aotContributionRegistersReflectionHintsForSuitableInnerClasses() { load(ComponentWithInnerAbstractClass.class); @@ -214,39 +224,47 @@ class JsonComponentModuleTests { return context; } + @Deprecated(since = "4.0.0", forRemoval = true) @JsonComponent static class OnlySerializer extends NameAndAgeJsonComponent.Serializer { } + @Deprecated(since = "4.0.0", forRemoval = true) @JsonComponent static class OnlyDeserializer extends NameAndAgeJsonComponent.Deserializer { } + @Deprecated(since = "4.0.0", forRemoval = true) @JsonComponent static class ComponentWithInnerAbstractClass { + @Deprecated(since = "4.0.0", forRemoval = true) abstract static class AbstractSerializer extends NameAndAgeJsonComponent.Serializer { } + @Deprecated(since = "4.0.0", forRemoval = true) static class ConcreteSerializer extends AbstractSerializer { } + @Deprecated(since = "4.0.0", forRemoval = true) static class NotSuitable { } } - @JsonComponent(scope = JsonComponent.Scope.KEYS) + @Deprecated(since = "4.0.0", forRemoval = true) + @JsonComponent(scope = org.springframework.boot.jackson2.JsonComponent.Scope.KEYS) static class OnlyKeySerializer extends NameAndAgeJsonKeyComponent.Serializer { } - @JsonComponent(scope = JsonComponent.Scope.KEYS, type = NameAndAge.class) + @Deprecated(since = "4.0.0", forRemoval = true) + @JsonComponent(scope = org.springframework.boot.jackson2.JsonComponent.Scope.KEYS, type = NameAndAge.class) static class OnlyKeyDeserializer extends NameAndAgeJsonKeyComponent.Deserializer { } diff --git a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/NameAndAgeJsonKeyComponent.java b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/NameAndAgeJsonKeyComponent.java index c34f4b084fe..ae23b10310e 100644 --- a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/NameAndAgeJsonKeyComponent.java +++ b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/NameAndAgeJsonKeyComponent.java @@ -34,11 +34,13 @@ import org.springframework.boot.jackson2.types.NameAndAge; */ @Deprecated(since = "4.0.0", forRemoval = true) @SuppressWarnings("removal") -@JsonComponent(type = NameAndAge.class, scope = JsonComponent.Scope.KEYS) +@JsonComponent(type = NameAndAge.class, scope = org.springframework.boot.jackson2.JsonComponent.Scope.KEYS) public class NameAndAgeJsonKeyComponent { + @Deprecated(since = "4.0.0", forRemoval = true) static class Serializer extends JsonSerializer { + @Deprecated(since = "4.0.0", forRemoval = true) @Override public void serialize(NameAndAge value, JsonGenerator jgen, SerializerProvider serializers) throws IOException { jgen.writeFieldName(value.asKey()); @@ -46,8 +48,10 @@ public class NameAndAgeJsonKeyComponent { } + @Deprecated(since = "4.0.0", forRemoval = true) static class Deserializer extends KeyDeserializer { + @Deprecated(since = "4.0.0", forRemoval = true) @Override public NameAndAge deserializeKey(String key, DeserializationContext ctxt) throws IOException { String[] keys = key.split("is"); diff --git a/module/spring-boot-jdbc-test/src/test/java/org/springframework/boot/jdbc/test/autoconfigure/JdbcTestWithAutoConfigureTestDatabaseReplaceAutoConfiguredIntegrationTests.java b/module/spring-boot-jdbc-test/src/test/java/org/springframework/boot/jdbc/test/autoconfigure/JdbcTestWithAutoConfigureTestDatabaseReplaceAutoConfiguredIntegrationTests.java index b81c75adea5..082cd47e85c 100644 --- a/module/spring-boot-jdbc-test/src/test/java/org/springframework/boot/jdbc/test/autoconfigure/JdbcTestWithAutoConfigureTestDatabaseReplaceAutoConfiguredIntegrationTests.java +++ b/module/spring-boot-jdbc-test/src/test/java/org/springframework/boot/jdbc/test/autoconfigure/JdbcTestWithAutoConfigureTestDatabaseReplaceAutoConfiguredIntegrationTests.java @@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.jdbc.EmbeddedDatabaseConnection; +import org.springframework.boot.jdbc.test.autoconfigure.AutoConfigureTestDatabase.Replace; import org.springframework.context.annotation.Configuration; import static org.assertj.core.api.Assertions.assertThat; @@ -34,8 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Stephane Nicoll */ @JdbcTest -@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.AUTO_CONFIGURED, - connection = EmbeddedDatabaseConnection.HSQLDB) +@AutoConfigureTestDatabase(replace = Replace.AUTO_CONFIGURED, connection = EmbeddedDatabaseConnection.HSQLDB) class JdbcTestWithAutoConfigureTestDatabaseReplaceAutoConfiguredIntegrationTests { @Autowired diff --git a/module/spring-boot-jdbc-test/src/test/java/org/springframework/boot/jdbc/test/autoconfigure/JdbcTestWithAutoConfigureTestDatabaseReplaceAutoConfiguredWithoutOverrideIntegrationTests.java b/module/spring-boot-jdbc-test/src/test/java/org/springframework/boot/jdbc/test/autoconfigure/JdbcTestWithAutoConfigureTestDatabaseReplaceAutoConfiguredWithoutOverrideIntegrationTests.java index c11ccf4f16f..285ac015ce9 100644 --- a/module/spring-boot-jdbc-test/src/test/java/org/springframework/boot/jdbc/test/autoconfigure/JdbcTestWithAutoConfigureTestDatabaseReplaceAutoConfiguredWithoutOverrideIntegrationTests.java +++ b/module/spring-boot-jdbc-test/src/test/java/org/springframework/boot/jdbc/test/autoconfigure/JdbcTestWithAutoConfigureTestDatabaseReplaceAutoConfiguredWithoutOverrideIntegrationTests.java @@ -21,6 +21,7 @@ import javax.sql.DataSource; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.jdbc.test.autoconfigure.AutoConfigureTestDatabase.Replace; import static org.assertj.core.api.Assertions.assertThat; @@ -31,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Stephane Nicoll */ @JdbcTest -@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.AUTO_CONFIGURED) +@AutoConfigureTestDatabase(replace = Replace.AUTO_CONFIGURED) class JdbcTestWithAutoConfigureTestDatabaseReplaceAutoConfiguredWithoutOverrideIntegrationTests { @Autowired diff --git a/module/spring-boot-jdbc-test/src/test/java/org/springframework/boot/jdbc/test/autoconfigure/JdbcTestWithAutoConfigureTestDatabaseReplaceNoneIntegrationTests.java b/module/spring-boot-jdbc-test/src/test/java/org/springframework/boot/jdbc/test/autoconfigure/JdbcTestWithAutoConfigureTestDatabaseReplaceNoneIntegrationTests.java index 8c02c4d16e6..d6f9d83afcb 100644 --- a/module/spring-boot-jdbc-test/src/test/java/org/springframework/boot/jdbc/test/autoconfigure/JdbcTestWithAutoConfigureTestDatabaseReplaceNoneIntegrationTests.java +++ b/module/spring-boot-jdbc-test/src/test/java/org/springframework/boot/jdbc/test/autoconfigure/JdbcTestWithAutoConfigureTestDatabaseReplaceNoneIntegrationTests.java @@ -21,6 +21,7 @@ import javax.sql.DataSource; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.jdbc.test.autoconfigure.AutoConfigureTestDatabase.Replace; import static org.assertj.core.api.Assertions.assertThat; @@ -31,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Stephane Nicoll */ @JdbcTest -@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) +@AutoConfigureTestDatabase(replace = Replace.NONE) class JdbcTestWithAutoConfigureTestDatabaseReplaceNoneIntegrationTests { @Autowired diff --git a/module/spring-boot-liquibase/src/main/java/org/springframework/boot/liquibase/autoconfigure/LiquibaseConnectionDetails.java b/module/spring-boot-liquibase/src/main/java/org/springframework/boot/liquibase/autoconfigure/LiquibaseConnectionDetails.java index 5be84609699..aaf2ddaa182 100644 --- a/module/spring-boot-liquibase/src/main/java/org/springframework/boot/liquibase/autoconfigure/LiquibaseConnectionDetails.java +++ b/module/spring-boot-liquibase/src/main/java/org/springframework/boot/liquibase/autoconfigure/LiquibaseConnectionDetails.java @@ -58,7 +58,7 @@ public interface LiquibaseConnectionDetails extends ConnectionDetails { * @see DatabaseDriver#fromJdbcUrl(String) * @see DatabaseDriver#getDriverClassName() */ - @Nullable default String getDriverClassName() { + default @Nullable String getDriverClassName() { String jdbcUrl = getJdbcUrl(); return (jdbcUrl != null) ? DatabaseDriver.fromJdbcUrl(jdbcUrl).getDriverClassName() : null; } diff --git a/module/spring-boot-web-server/src/main/java/org/springframework/boot/web/server/Cookie.java b/module/spring-boot-web-server/src/main/java/org/springframework/boot/web/server/Cookie.java index 69b16370f07..ff5d5ee0280 100644 --- a/module/spring-boot-web-server/src/main/java/org/springframework/boot/web/server/Cookie.java +++ b/module/spring-boot-web-server/src/main/java/org/springframework/boot/web/server/Cookie.java @@ -170,7 +170,7 @@ public class Cookie { */ STRICT("Strict"); - private @Nullable final String attributeValue; + private final @Nullable String attributeValue; SameSite(@Nullable String attributeValue) { this.attributeValue = attributeValue; diff --git a/module/spring-boot-web-server/src/testFixtures/java/org/springframework/boot/web/server/servlet/AbstractServletWebServerFactoryTests.java b/module/spring-boot-web-server/src/testFixtures/java/org/springframework/boot/web/server/servlet/AbstractServletWebServerFactoryTests.java index c841c7de887..82877466a4c 100644 --- a/module/spring-boot-web-server/src/testFixtures/java/org/springframework/boot/web/server/servlet/AbstractServletWebServerFactoryTests.java +++ b/module/spring-boot-web-server/src/testFixtures/java/org/springframework/boot/web/server/servlet/AbstractServletWebServerFactoryTests.java @@ -114,6 +114,7 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; +import org.junit.jupiter.params.provider.EnumSource.Mode; import org.mockito.InOrder; import org.springframework.boot.ssl.DefaultSslBundleRegistry; @@ -914,7 +915,7 @@ public abstract class AbstractServletWebServerFactoryTests { } @ParameterizedTest - @EnumSource(mode = EnumSource.Mode.EXCLUDE, names = "OMITTED") + @EnumSource(mode = Mode.EXCLUDE, names = "OMITTED") void sessionCookieSameSiteAttributeCanBeConfiguredAndOnlyAffectsSessionCookies(SameSite sameSite) throws Exception { ConfigurableServletWebServerFactory factory = getFactory(); factory.getSettings().getSession().getCookie().setSameSite(sameSite); @@ -929,7 +930,7 @@ public abstract class AbstractServletWebServerFactoryTests { } @ParameterizedTest - @EnumSource(mode = EnumSource.Mode.EXCLUDE, names = "OMITTED") + @EnumSource(mode = Mode.EXCLUDE, names = "OMITTED") void sessionCookieSameSiteAttributeCanBeConfiguredAndOnlyAffectsSessionCookiesWhenUsingCustomName(SameSite sameSite) throws Exception { ConfigurableServletWebServerFactory factory = getFactory(); diff --git a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/CorsSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/CorsSampleActuatorApplicationTests.java index c32cb39606e..7b344c8f5d0 100644 --- a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/CorsSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/CorsSampleActuatorApplicationTests.java @@ -27,6 +27,7 @@ import org.springframework.boot.restclient.RestTemplateBuilder; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.http.server.LocalTestWebServer; import org.springframework.context.ApplicationContext; import org.springframework.http.HttpStatus; @@ -41,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Madhura Bhave */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @ActiveProfiles("cors") @AutoConfigureTestRestTemplate class CorsSampleActuatorApplicationTests { diff --git a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/CustomServletPathSampleActuatorTests.java b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/CustomServletPathSampleActuatorTests.java index 3d186ca7ab8..019120f25f3 100644 --- a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/CustomServletPathSampleActuatorTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/CustomServletPathSampleActuatorTests.java @@ -18,6 +18,7 @@ package smoketest.actuator.customsecurity; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.context.ApplicationContext; @@ -26,8 +27,7 @@ import org.springframework.context.ApplicationContext; * * @author Madhura Bhave */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, - properties = "spring.mvc.servlet.path=/example") +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.mvc.servlet.path=/example") class CustomServletPathSampleActuatorTests extends AbstractSampleActuatorCustomSecurityTests { @LocalServerPort diff --git a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/ManagementServerWithCustomServletPathSampleActuatorTests.java b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/ManagementServerWithCustomServletPathSampleActuatorTests.java index 9a2192d5557..27593e663e2 100644 --- a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/ManagementServerWithCustomServletPathSampleActuatorTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/ManagementServerWithCustomServletPathSampleActuatorTests.java @@ -21,6 +21,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalManagementPort; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.context.ApplicationContext; @@ -35,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Madhura Bhave */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.server.port=0", "spring.mvc.servlet.path=/example" }) class ManagementServerWithCustomServletPathSampleActuatorTests extends AbstractSampleActuatorCustomSecurityTests { diff --git a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/SampleActuatorCustomSecurityApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/SampleActuatorCustomSecurityApplicationTests.java index 63bf2a83cee..3ee236080e8 100644 --- a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/SampleActuatorCustomSecurityApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/SampleActuatorCustomSecurityApplicationTests.java @@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.context.ApplicationContext; import org.springframework.http.HttpStatus; @@ -36,8 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Stephane Nicoll * @author Scott Frederick */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, - properties = { "spring.web.error.include-message=always" }) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "spring.web.error.include-message=always" }) class SampleActuatorCustomSecurityApplicationTests extends AbstractSampleActuatorCustomSecurityTests { @LocalServerPort diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/CorsSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/CorsSampleActuatorApplicationTests.java index c2a2fe31e3b..eae5d6c6ee6 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/CorsSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/CorsSampleActuatorApplicationTests.java @@ -27,6 +27,7 @@ import org.springframework.boot.restclient.RestTemplateBuilder; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.http.server.LocalTestWebServer; import org.springframework.context.ApplicationContext; import org.springframework.http.HttpStatus; @@ -41,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Madhura Bhave */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @ActiveProfiles("cors") @AutoConfigureTestRestTemplate class CorsSampleActuatorApplicationTests { diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementDifferentPortAndEndpointWithExceptionHandlerSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementDifferentPortAndEndpointWithExceptionHandlerSampleActuatorApplicationTests.java index c3c52cc205c..ad5c6902fcf 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementDifferentPortAndEndpointWithExceptionHandlerSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementDifferentPortAndEndpointWithExceptionHandlerSampleActuatorApplicationTests.java @@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalManagementPort; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -34,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Guirong Hu */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.endpoints.web.exposure.include=*", "management.server.port=0" }) class ManagementDifferentPortAndEndpointWithExceptionHandlerSampleActuatorApplicationTests { diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementDifferentPortSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementDifferentPortSampleActuatorApplicationTests.java index 3168a90d328..41f252de820 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementDifferentPortSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementDifferentPortSampleActuatorApplicationTests.java @@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalManagementPort; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -32,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author HaiTao Zhang */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.endpoints.web.base-path=/", "management.server.port=0" }) class ManagementDifferentPortSampleActuatorApplicationTests { diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementPortWithLazyInitializationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementPortWithLazyInitializationTests.java index 69e03630aee..5dda6fba1b8 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementPortWithLazyInitializationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementPortWithLazyInitializationTests.java @@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalManagementPort; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -32,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Madhura Bhave */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.server.port=0", "spring.main.lazy-initialization=true" }) class ManagementPortWithLazyInitializationTests { diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementRandomPortWithConfiguredPortSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementRandomPortWithConfiguredPortSampleActuatorApplicationTests.java index 8ce53f3fd59..7d3b6def6e4 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementRandomPortWithConfiguredPortSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementRandomPortWithConfiguredPortSampleActuatorApplicationTests.java @@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalManagementPort; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.http.HttpStatus; @@ -33,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Stephane Nicoll */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, args = "--management.server.port=1234") +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, args = "--management.server.port=1234") class ManagementRandomPortWithConfiguredPortSampleActuatorApplicationTests { @LocalServerPort diff --git a/smoke-test/spring-boot-smoke-test-jersey/src/test/java/smoketest/jersey/AbstractJerseyManagementPortTests.java b/smoke-test/spring-boot-smoke-test-jersey/src/test/java/smoketest/jersey/AbstractJerseyManagementPortTests.java index 9b131217bff..ea0aba47aeb 100644 --- a/smoke-test/spring-boot-smoke-test-jersey/src/test/java/smoketest/jersey/AbstractJerseyManagementPortTests.java +++ b/smoke-test/spring-boot-smoke-test-jersey/src/test/java/smoketest/jersey/AbstractJerseyManagementPortTests.java @@ -26,6 +26,7 @@ import org.springframework.boot.jersey.autoconfigure.ResourceConfigCustomizer; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.test.web.server.LocalManagementPort; import org.springframework.boot.test.web.server.LocalServerPort; @@ -43,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Madhura Bhave */ @AutoConfigureTestRestTemplate -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = "management.server.port=0") +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "management.server.port=0") @Import(ResourceConfigConfiguration.class) class AbstractJerseyManagementPortTests { diff --git a/smoke-test/spring-boot-smoke-test-jersey/src/test/java/smoketest/jersey/JerseyApplicationPathAndManagementPortTests.java b/smoke-test/spring-boot-smoke-test-jersey/src/test/java/smoketest/jersey/JerseyApplicationPathAndManagementPortTests.java index c56376ec69d..d7726a24613 100644 --- a/smoke-test/spring-boot-smoke-test-jersey/src/test/java/smoketest/jersey/JerseyApplicationPathAndManagementPortTests.java +++ b/smoke-test/spring-boot-smoke-test-jersey/src/test/java/smoketest/jersey/JerseyApplicationPathAndManagementPortTests.java @@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalManagementPort; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.http.HttpStatus; @@ -36,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Madhura Bhave */ @AutoConfigureTestRestTemplate -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.server.port=0", "spring.jersey.application-path=/app" }) class JerseyApplicationPathAndManagementPortTests { diff --git a/smoke-test/spring-boot-smoke-test-jersey/src/test/java/smoketest/jersey/JerseyDifferentPortSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-jersey/src/test/java/smoketest/jersey/JerseyDifferentPortSampleActuatorApplicationTests.java index b27538dfb06..16a1f6adab0 100644 --- a/smoke-test/spring-boot-smoke-test-jersey/src/test/java/smoketest/jersey/JerseyDifferentPortSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-jersey/src/test/java/smoketest/jersey/JerseyDifferentPortSampleActuatorApplicationTests.java @@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalManagementPort; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -32,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author HaiTao Zhang */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.server.port=0", "management.endpoints.web.base-path=/" }) class JerseyDifferentPortSampleActuatorApplicationTests { diff --git a/smoke-test/spring-boot-smoke-test-oauth2-authorization-server/src/test/java/smoketest/oauth2/server/SampleOAuth2AuthorizationServerApplicationTests.java b/smoke-test/spring-boot-smoke-test-oauth2-authorization-server/src/test/java/smoketest/oauth2/server/SampleOAuth2AuthorizationServerApplicationTests.java index daa32699cf8..bfa4ae04ff6 100644 --- a/smoke-test/spring-boot-smoke-test-oauth2-authorization-server/src/test/java/smoketest/oauth2/server/SampleOAuth2AuthorizationServerApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-oauth2-authorization-server/src/test/java/smoketest/oauth2/server/SampleOAuth2AuthorizationServerApplicationTests.java @@ -28,6 +28,7 @@ import org.springframework.boot.http.client.HttpRedirects; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; @@ -46,7 +47,7 @@ import org.springframework.util.MultiValueMap; import static org.assertj.core.api.Assertions.assertThat; -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @AutoConfigureTestRestTemplate class SampleOAuth2AuthorizationServerApplicationTests { diff --git a/smoke-test/spring-boot-smoke-test-oauth2-client/src/test/java/smoketest/oauth2/client/SampleOAuth2ClientApplicationTests.java b/smoke-test/spring-boot-smoke-test-oauth2-client/src/test/java/smoketest/oauth2/client/SampleOAuth2ClientApplicationTests.java index 64c268c62a9..3f6073c9670 100644 --- a/smoke-test/spring-boot-smoke-test-oauth2-client/src/test/java/smoketest/oauth2/client/SampleOAuth2ClientApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-oauth2-client/src/test/java/smoketest/oauth2/client/SampleOAuth2ClientApplicationTests.java @@ -25,13 +25,14 @@ import org.springframework.boot.http.client.HttpRedirects; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import static org.assertj.core.api.Assertions.assertThat; -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "APP-CLIENT-ID=my-client-id", "APP-CLIENT-SECRET=my-client-secret", "YAHOO-CLIENT-ID=my-yahoo-client-id", "YAHOO-CLIENT-SECRET=my-yahoo-client-secret" }) @AutoConfigureTestRestTemplate diff --git a/smoke-test/spring-boot-smoke-test-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleOauth2ResourceServerApplicationTests.java b/smoke-test/spring-boot-smoke-test-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleOauth2ResourceServerApplicationTests.java index bb4b93c88c5..96917e4b11c 100644 --- a/smoke-test/spring-boot-smoke-test-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleOauth2ResourceServerApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleOauth2ResourceServerApplicationTests.java @@ -28,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -37,7 +38,7 @@ import org.springframework.http.ResponseEntity; import static org.assertj.core.api.Assertions.assertThat; -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @AutoConfigureTestRestTemplate class SampleOauth2ResourceServerApplicationTests { diff --git a/smoke-test/spring-boot-smoke-test-profile/src/test/java/smoketest/profile/AttributeInjectionTests.java b/smoke-test/spring-boot-smoke-test-profile/src/test/java/smoketest/profile/AttributeInjectionTests.java index a7509ccc93f..cb84a61c249 100644 --- a/smoke-test/spring-boot-smoke-test-profile/src/test/java/smoketest/profile/AttributeInjectionTests.java +++ b/smoke-test/spring-boot-smoke-test-profile/src/test/java/smoketest/profile/AttributeInjectionTests.java @@ -20,11 +20,12 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import static org.assertj.core.api.Assertions.assertThat; // gh-29169 -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) class AttributeInjectionTests { @Autowired(required = false) diff --git a/smoke-test/spring-boot-smoke-test-reactive-oauth2-client/src/test/java/smoketest/oauth2/client/SampleReactiveOAuth2ClientApplicationTests.java b/smoke-test/spring-boot-smoke-test-reactive-oauth2-client/src/test/java/smoketest/oauth2/client/SampleReactiveOAuth2ClientApplicationTests.java index 4deafb0e539..67a6de49a47 100644 --- a/smoke-test/spring-boot-smoke-test-reactive-oauth2-client/src/test/java/smoketest/oauth2/client/SampleReactiveOAuth2ClientApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-reactive-oauth2-client/src/test/java/smoketest/oauth2/client/SampleReactiveOAuth2ClientApplicationTests.java @@ -20,12 +20,13 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.webtestclient.autoconfigure.AutoConfigureWebTestClient; import org.springframework.test.web.reactive.server.WebTestClient; import static org.assertj.core.api.Assertions.assertThat; -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "APP-CLIENT-ID=my-client-id", "APP-CLIENT-SECRET=my-client-secret", "YAHOO-CLIENT-ID=my-google-client-id", "YAHOO-CLIENT-SECRET=my-google-client-secret" }) @AutoConfigureWebTestClient diff --git a/smoke-test/spring-boot-smoke-test-reactive-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleReactiveOAuth2ResourceServerApplicationTests.java b/smoke-test/spring-boot-smoke-test-reactive-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleReactiveOAuth2ResourceServerApplicationTests.java index 8743a2f6215..e9e2885976e 100644 --- a/smoke-test/spring-boot-smoke-test-reactive-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleReactiveOAuth2ResourceServerApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-reactive-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleReactiveOAuth2ResourceServerApplicationTests.java @@ -24,12 +24,13 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.webtestclient.autoconfigure.AutoConfigureWebTestClient; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.test.web.reactive.server.WebTestClient; -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @AutoConfigureWebTestClient class SampleReactiveOAuth2ResourceServerApplicationTests { diff --git a/smoke-test/spring-boot-smoke-test-saml2-service-provider/src/test/java/smoketest/saml2/serviceprovider/SampleSaml2RelyingPartyApplicationTests.java b/smoke-test/spring-boot-smoke-test-saml2-service-provider/src/test/java/smoketest/saml2/serviceprovider/SampleSaml2RelyingPartyApplicationTests.java index 1123740a024..8a8eeff9ec2 100644 --- a/smoke-test/spring-boot-smoke-test-saml2-service-provider/src/test/java/smoketest/saml2/serviceprovider/SampleSaml2RelyingPartyApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-saml2-service-provider/src/test/java/smoketest/saml2/serviceprovider/SampleSaml2RelyingPartyApplicationTests.java @@ -25,13 +25,14 @@ import org.springframework.boot.http.client.HttpRedirects; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import static org.assertj.core.api.Assertions.assertThat; -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @AutoConfigureTestRestTemplate class SampleSaml2RelyingPartyApplicationTests { diff --git a/smoke-test/spring-boot-smoke-test-secure-jersey/src/test/java/smoketest/secure/jersey/CustomApplicationPathActuatorTests.java b/smoke-test/spring-boot-smoke-test-secure-jersey/src/test/java/smoketest/secure/jersey/CustomApplicationPathActuatorTests.java index 34a3025f805..0c2b5e7f8d0 100644 --- a/smoke-test/spring-boot-smoke-test-secure-jersey/src/test/java/smoketest/secure/jersey/CustomApplicationPathActuatorTests.java +++ b/smoke-test/spring-boot-smoke-test-secure-jersey/src/test/java/smoketest/secure/jersey/CustomApplicationPathActuatorTests.java @@ -17,6 +17,7 @@ package smoketest.secure.jersey; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalServerPort; /** @@ -24,8 +25,7 @@ import org.springframework.boot.test.web.server.LocalServerPort; * * @author Madhura Bhave */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, - properties = "spring.jersey.application-path=/example") +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.jersey.application-path=/example") class CustomApplicationPathActuatorTests extends AbstractJerseySecureTests { @LocalServerPort diff --git a/smoke-test/spring-boot-smoke-test-secure-jersey/src/test/java/smoketest/secure/jersey/JerseySecureApplicationTests.java b/smoke-test/spring-boot-smoke-test-secure-jersey/src/test/java/smoketest/secure/jersey/JerseySecureApplicationTests.java index 0a5fb286922..6113f442693 100644 --- a/smoke-test/spring-boot-smoke-test-secure-jersey/src/test/java/smoketest/secure/jersey/JerseySecureApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-secure-jersey/src/test/java/smoketest/secure/jersey/JerseySecureApplicationTests.java @@ -17,6 +17,7 @@ package smoketest.secure.jersey; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalServerPort; /** @@ -25,7 +26,7 @@ import org.springframework.boot.test.web.server.LocalServerPort; * @author Madhura Bhave * @author Stephane Nicoll */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) class JerseySecureApplicationTests extends AbstractJerseySecureTests { @LocalServerPort diff --git a/smoke-test/spring-boot-smoke-test-secure-jersey/src/test/java/smoketest/secure/jersey/ManagementPortCustomApplicationPathJerseyTests.java b/smoke-test/spring-boot-smoke-test-secure-jersey/src/test/java/smoketest/secure/jersey/ManagementPortCustomApplicationPathJerseyTests.java index 84442ce9097..5baaf654713 100644 --- a/smoke-test/spring-boot-smoke-test-secure-jersey/src/test/java/smoketest/secure/jersey/ManagementPortCustomApplicationPathJerseyTests.java +++ b/smoke-test/spring-boot-smoke-test-secure-jersey/src/test/java/smoketest/secure/jersey/ManagementPortCustomApplicationPathJerseyTests.java @@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalManagementPort; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.http.HttpStatus; @@ -33,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Madhura Bhave */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.server.port=0", "spring.jersey.application-path=/example" }) class ManagementPortCustomApplicationPathJerseyTests extends AbstractJerseySecureTests { diff --git a/smoke-test/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/CorsSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/CorsSampleActuatorApplicationTests.java index 829a8a15bd0..ef0434b17d7 100644 --- a/smoke-test/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/CorsSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/CorsSampleActuatorApplicationTests.java @@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.webtestclient.autoconfigure.AutoConfigureWebTestClient; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.web.reactive.server.WebTestClient; @@ -29,7 +30,7 @@ import org.springframework.test.web.reactive.server.WebTestClient; * * @author Madhura Bhave */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @ActiveProfiles("cors") @AutoConfigureWebTestClient class CorsSampleActuatorApplicationTests { diff --git a/smoke-test/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/SampleSecureWebFluxApplicationTests.java b/smoke-test/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/SampleSecureWebFluxApplicationTests.java index 4706df9613b..32346caabcd 100644 --- a/smoke-test/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/SampleSecureWebFluxApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/SampleSecureWebFluxApplicationTests.java @@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.webtestclient.autoconfigure.AutoConfigureWebTestClient; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -32,7 +33,7 @@ import org.springframework.test.web.reactive.server.WebTestClient; * * @author Madhura Bhave */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "management.endpoint.health.show-details=never") @AutoConfigureWebTestClient class SampleSecureWebFluxApplicationTests { diff --git a/smoke-test/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/SampleSecureWebFluxCustomSecurityTests.java b/smoke-test/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/SampleSecureWebFluxCustomSecurityTests.java index 6b663d8663b..b1b4269ebc3 100644 --- a/smoke-test/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/SampleSecureWebFluxCustomSecurityTests.java +++ b/smoke-test/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/SampleSecureWebFluxCustomSecurityTests.java @@ -25,6 +25,7 @@ import org.springframework.boot.actuate.web.mappings.MappingsEndpoint; import org.springframework.boot.security.autoconfigure.actuate.web.reactive.EndpointRequest; import org.springframework.boot.security.autoconfigure.web.reactive.PathRequest; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.webtestclient.autoconfigure.AutoConfigureWebTestClient; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -43,7 +44,7 @@ import static org.springframework.security.config.Customizer.withDefaults; * * @author Madhura Bhave */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = { SampleSecureWebFluxCustomSecurityTests.SecurityConfiguration.class, SampleSecureWebFluxApplication.class }) @AutoConfigureWebTestClient diff --git a/smoke-test/spring-boot-smoke-test-session-data-redis-webflux/src/dockerTest/java/smoketest/session/SampleSessionWebFluxRedisApplicationTests.java b/smoke-test/spring-boot-smoke-test-session-data-redis-webflux/src/dockerTest/java/smoketest/session/SampleSessionWebFluxRedisApplicationTests.java index c00bf01a498..09df1803495 100644 --- a/smoke-test/spring-boot-smoke-test-session-data-redis-webflux/src/dockerTest/java/smoketest/session/SampleSessionWebFluxRedisApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-session-data-redis-webflux/src/dockerTest/java/smoketest/session/SampleSessionWebFluxRedisApplicationTests.java @@ -27,6 +27,7 @@ import reactor.util.function.Tuples; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.boot.testcontainers.service.connection.ServiceConnection; import org.springframework.boot.testsupport.container.TestImage; @@ -45,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson * @author Phillip Webb */ -@SpringBootTest(properties = "spring.session.timeout:10", webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(properties = "spring.session.timeout:10", webEnvironment = WebEnvironment.RANDOM_PORT) @Testcontainers(disabledWithoutDocker = true) class SampleSessionWebFluxRedisApplicationTests { diff --git a/smoke-test/spring-boot-smoke-test-session-data-redis/src/dockerTest/java/smoketest/session/redis/SampleSessionRedisApplicationTests.java b/smoke-test/spring-boot-smoke-test-session-data-redis/src/dockerTest/java/smoketest/session/redis/SampleSessionRedisApplicationTests.java index 8357eea38cf..f01468e9b0f 100644 --- a/smoke-test/spring-boot-smoke-test-session-data-redis/src/dockerTest/java/smoketest/session/redis/SampleSessionRedisApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-session-data-redis/src/dockerTest/java/smoketest/session/redis/SampleSessionRedisApplicationTests.java @@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.testcontainers.service.connection.ServiceConnection; import org.springframework.boot.testsupport.container.TestImage; import org.springframework.core.ParameterizedTypeReference; @@ -53,7 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson * @author Phillip Webb */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @Testcontainers(disabledWithoutDocker = true) @AutoConfigureTestRestTemplate class SampleSessionRedisApplicationTests { diff --git a/smoke-test/spring-boot-smoke-test-session-jdbc/src/test/java/smoketest/session/SampleSessionJdbcApplicationTests.java b/smoke-test/spring-boot-smoke-test-session-jdbc/src/test/java/smoketest/session/SampleSessionJdbcApplicationTests.java index bf669174b17..3a720443b70 100644 --- a/smoke-test/spring-boot-smoke-test-session-jdbc/src/test/java/smoketest/session/SampleSessionJdbcApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-session-jdbc/src/test/java/smoketest/session/SampleSessionJdbcApplicationTests.java @@ -31,6 +31,7 @@ import org.springframework.boot.http.client.HttpRedirects; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpHeaders; @@ -53,7 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Vedran Pavic * @author Madhura Bhave */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "server.servlet.session.timeout:2", "debug=true" }) @AutoConfigureTestRestTemplate class SampleSessionJdbcApplicationTests { diff --git a/smoke-test/spring-boot-smoke-test-test/src/test/java/smoketest/test/service/RemoteVehicleDetailsServiceTests.java b/smoke-test/spring-boot-smoke-test-test/src/test/java/smoketest/test/service/RemoteVehicleDetailsServiceTests.java index 8b133391b07..4addd1fd959 100644 --- a/smoke-test/spring-boot-smoke-test-test/src/test/java/smoketest/test/service/RemoteVehicleDetailsServiceTests.java +++ b/smoke-test/spring-boot-smoke-test-test/src/test/java/smoketest/test/service/RemoteVehicleDetailsServiceTests.java @@ -18,6 +18,7 @@ package smoketest.test.service; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.TestInstance.Lifecycle; import smoketest.test.domain.VehicleIdentificationNumber; import org.springframework.beans.factory.annotation.Autowired; @@ -45,7 +46,7 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat * @author Stephane Nicoll */ @RestClientTest -@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@TestInstance(Lifecycle.PER_CLASS) class RemoteVehicleDetailsServiceTests { private static final String VIN = "00000000000000000"; diff --git a/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/CustomContextPathUnauthenticatedErrorPageTests.java b/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/CustomContextPathUnauthenticatedErrorPageTests.java index 859f808afc3..e01f8162fd0 100644 --- a/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/CustomContextPathUnauthenticatedErrorPageTests.java +++ b/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/CustomContextPathUnauthenticatedErrorPageTests.java @@ -17,13 +17,14 @@ package smoketest.web.secure; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; /** * Tests for error page that permits access to all with a custom context path. * * @author Madhura Bhave */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = { AbstractErrorPageTests.TestConfiguration.class, UnauthenticatedErrorPageTests.SecurityConfiguration.class, SampleWebSecureApplication.class }, properties = { "spring.web.error.include-message=always", "spring.security.user.name=username", diff --git a/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/CustomServletPathUnauthenticatedErrorPageTests.java b/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/CustomServletPathUnauthenticatedErrorPageTests.java index 9038ac1966e..2b4e070238a 100644 --- a/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/CustomServletPathUnauthenticatedErrorPageTests.java +++ b/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/CustomServletPathUnauthenticatedErrorPageTests.java @@ -17,6 +17,7 @@ package smoketest.web.secure; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.annotation.Bean; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.web.SecurityFilterChain; @@ -28,10 +29,8 @@ import static org.springframework.security.config.Customizer.withDefaults; * * @author Andy Wilkinson */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, - classes = { AbstractErrorPageTests.TestConfiguration.class, - CustomServletPathUnauthenticatedErrorPageTests.SecurityConfiguration.class, - SampleWebSecureApplication.class }, +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = { AbstractErrorPageTests.TestConfiguration.class, + CustomServletPathUnauthenticatedErrorPageTests.SecurityConfiguration.class, SampleWebSecureApplication.class }, properties = { "spring.web.error.include-message=always", "spring.security.user.name=username", "spring.security.user.password=password", "spring.mvc.servlet.path=/custom/servlet/path" }) class CustomServletPathUnauthenticatedErrorPageTests extends AbstractUnauthenticatedErrorPageTests { diff --git a/smoke-test/spring-boot-smoke-test-webflux/src/test/java/smoketest/webflux/SampleWebFluxApplicationActuatorDifferentPortTests.java b/smoke-test/spring-boot-smoke-test-webflux/src/test/java/smoketest/webflux/SampleWebFluxApplicationActuatorDifferentPortTests.java index bed7a5b4ad9..27403ec701c 100644 --- a/smoke-test/spring-boot-smoke-test-webflux/src/test/java/smoketest/webflux/SampleWebFluxApplicationActuatorDifferentPortTests.java +++ b/smoke-test/spring-boot-smoke-test-webflux/src/test/java/smoketest/webflux/SampleWebFluxApplicationActuatorDifferentPortTests.java @@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalManagementPort; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -32,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author HaiTao Zhang */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.server.port=0", "management.endpoints.web.base-path=/" }) class SampleWebFluxApplicationActuatorDifferentPortTests { diff --git a/smoke-test/spring-boot-smoke-test-webflux/src/test/java/smoketest/webflux/SampleWebFluxApplicationActuatorIsolatedJsonMapperFalseTests.java b/smoke-test/spring-boot-smoke-test-webflux/src/test/java/smoketest/webflux/SampleWebFluxApplicationActuatorIsolatedJsonMapperFalseTests.java index dd056c91cad..bc24e1834fb 100644 --- a/smoke-test/spring-boot-smoke-test-webflux/src/test/java/smoketest/webflux/SampleWebFluxApplicationActuatorIsolatedJsonMapperFalseTests.java +++ b/smoke-test/spring-boot-smoke-test-webflux/src/test/java/smoketest/webflux/SampleWebFluxApplicationActuatorIsolatedJsonMapperFalseTests.java @@ -21,6 +21,7 @@ import tools.jackson.databind.json.JsonMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.webtestclient.autoconfigure.AutoConfigureWebTestClient; import org.springframework.http.MediaType; import org.springframework.test.context.ContextConfiguration; @@ -31,7 +32,7 @@ import org.springframework.test.web.reactive.server.WebTestClient; * * @author Phillip Webb */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.endpoints.jackson.isolated-json-mapper=false", "spring.jackson.mapper.require-setters-for-getters=true" }) @ContextConfiguration(loader = ApplicationStartupSpringBootContextLoader.class) diff --git a/smoke-test/spring-boot-smoke-test-webflux/src/test/java/smoketest/webflux/SampleWebFluxApplicationActuatorIsolatedJsonMapperTrueTests.java b/smoke-test/spring-boot-smoke-test-webflux/src/test/java/smoketest/webflux/SampleWebFluxApplicationActuatorIsolatedJsonMapperTrueTests.java index 6f9c8ef47fa..412b067b92c 100644 --- a/smoke-test/spring-boot-smoke-test-webflux/src/test/java/smoketest/webflux/SampleWebFluxApplicationActuatorIsolatedJsonMapperTrueTests.java +++ b/smoke-test/spring-boot-smoke-test-webflux/src/test/java/smoketest/webflux/SampleWebFluxApplicationActuatorIsolatedJsonMapperTrueTests.java @@ -23,6 +23,7 @@ import tools.jackson.databind.json.JsonMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.webtestclient.autoconfigure.AutoConfigureWebTestClient; import org.springframework.http.MediaType; import org.springframework.test.context.ContextConfiguration; @@ -36,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Phillip Webb */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.endpoints.jackson.isolated-json-mapper=true", "spring.jackson.mapper.require-setters-for-getters=true" }) @ContextConfiguration(loader = ApplicationStartupSpringBootContextLoader.class)