diff --git a/gradle/ide.gradle b/gradle/ide.gradle
index d5215f2875f2..9d3db1023813 100644
--- a/gradle/ide.gradle
+++ b/gradle/ide.gradle
@@ -4,8 +4,8 @@ import org.gradle.plugins.ide.eclipse.model.SourceFolder
apply plugin: 'eclipse'
eclipse.jdt {
- sourceCompatibility = 1.8
- targetCompatibility = 1.8
+ sourceCompatibility = 17
+ targetCompatibility = 17
}
// Replace classpath entries with project dependencies (GRADLE-1116)
diff --git a/import-into-eclipse.md b/import-into-eclipse.md
index fc3d36a8854b..1ab36c1fcfd3 100644
--- a/import-into-eclipse.md
+++ b/import-into-eclipse.md
@@ -3,7 +3,7 @@
This document will guide you through the process of importing the Spring Framework
projects into Eclipse or the Spring Tool Suite (_STS_). It is recommended that you
have a recent version of Eclipse. As a bare minimum you will need Eclipse with full Java
-8 support, Eclipse Buildship, and the Groovy plugin.
+17 support, Eclipse Buildship, and the Groovy plugin.
The following instructions have been tested against [STS](https://spring.io/tools) 4.12.0
([download](https://github.com/spring-projects/sts4/wiki/Previous-Versions#spring-tools-4120-changelog))
@@ -12,6 +12,10 @@ The instructions should work with the latest Eclipse distribution as long as you
[Buildship](https://marketplace.eclipse.org/content/buildship-gradle-integration). Note
that STS 4 comes with Buildship preinstalled.
+If you are using Eclipse 4.21, you will need to install
+[Java 17 Support for Eclipse 2021-09 (4.21)](https://marketplace.eclipse.org/content/java-17-support-eclipse-2021-09-421)
+from the Eclipse Marketplace.
+
## Steps
_When instructed to execute `./gradlew` from the command line, be sure to execute it within your locally cloned `spring-framework` working directory._
diff --git a/spring-oxm/spring-oxm.gradle b/spring-oxm/spring-oxm.gradle
index bce9c1517691..0778059690c2 100644
--- a/spring-oxm/spring-oxm.gradle
+++ b/spring-oxm/spring-oxm.gradle
@@ -22,7 +22,6 @@ dependencies {
optional("com.thoughtworks.xstream:xstream")
testImplementation(project(":spring-context"))
testImplementation(testFixtures(project(":spring-core")))
- testImplementation("org.ogce:xpp3")
testImplementation("org.codehaus.jettison:jettison") {
exclude group: "stax", module: "stax-api"
}
diff --git a/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamMarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamMarshallerTests.java
index 304d3fcc771b..ece6236ecd75 100644
--- a/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamMarshallerTests.java
+++ b/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamMarshallerTests.java
@@ -43,6 +43,8 @@
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
import com.thoughtworks.xstream.io.json.JsonHierarchicalStreamDriver;
import com.thoughtworks.xstream.io.json.JsonWriter;
+import com.thoughtworks.xstream.io.xml.DomDriver;
+import com.thoughtworks.xstream.io.xml.XmlFriendlyNameCoder;
import com.thoughtworks.xstream.security.AnyTypePermission;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -84,6 +86,7 @@ void createMarshaller() {
marshaller = new XStreamMarshaller();
marshaller.setTypePermissions(AnyTypePermission.ANY);
marshaller.setAliases(Collections.singletonMap("flight", Flight.class.getName()));
+ marshaller.setStreamDriver(new DomDriver("UTF-8", new XmlFriendlyNameCoder()));
flight.setFlightNumber(42L);
}
@@ -139,7 +142,7 @@ void marshalStreamResultWriter() throws Exception {
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
marshaller.marshal(flight, result);
- assertThat(XmlContent.from(writer)).isSimilarTo(EXPECTED_STRING);
+ assertThat(XmlContent.from(writer)).isSimilarToIgnoringWhitespace(EXPECTED_STRING);
}
@Test
@@ -148,7 +151,7 @@ void marshalStreamResultOutputStream() throws Exception {
StreamResult result = new StreamResult(os);
marshaller.marshal(flight, result);
String s = os.toString("UTF-8");
- assertThat(XmlContent.of(s)).isSimilarTo(EXPECTED_STRING);
+ assertThat(XmlContent.of(s)).isSimilarToIgnoringWhitespace(EXPECTED_STRING);
}
@Test
@@ -254,7 +257,7 @@ void aliasesByTypeStringClassMap() throws Exception {
Writer writer = new StringWriter();
marshaller.marshal(flight, new StreamResult(writer));
- assertThat(XmlContent.from(writer)).isSimilarTo(EXPECTED_STRING);
+ assertThat(XmlContent.from(writer)).isSimilarToIgnoringWhitespace(EXPECTED_STRING);
}
@Test
@@ -267,7 +270,7 @@ void aliasesByTypeStringStringMap() throws Exception {
Writer writer = new StringWriter();
marshaller.marshal(flight, new StreamResult(writer));
- assertThat(XmlContent.from(writer)).isSimilarTo(EXPECTED_STRING);
+ assertThat(XmlContent.from(writer)).isSimilarToIgnoringWhitespace(EXPECTED_STRING);
}
@Test
@@ -276,7 +279,7 @@ void fieldAliases() throws Exception {
Writer writer = new StringWriter();
marshaller.marshal(flight, new StreamResult(writer));
String expected = "42";
- assertThat(XmlContent.from(writer)).isSimilarTo(expected);
+ assertThat(XmlContent.from(writer)).isSimilarToIgnoringWhitespace(expected);
}
@Test
@@ -351,7 +354,7 @@ void annotatedMarshalStreamResultWriter() throws Exception {
flight.setFlightNumber(42);
marshaller.marshal(flight, result);
String expected = "42";
- assertThat(XmlContent.from(writer)).isSimilarTo(expected);
+ assertThat(XmlContent.from(writer)).isSimilarToIgnoringWhitespace(expected);
}
diff --git a/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamUnmarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamUnmarshallerTests.java
index 7c87eda2253b..9d8d61b7bea6 100644
--- a/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamUnmarshallerTests.java
+++ b/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamUnmarshallerTests.java
@@ -30,6 +30,8 @@
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamSource;
+import com.thoughtworks.xstream.io.xml.DomDriver;
+import com.thoughtworks.xstream.io.xml.XmlFriendlyNameCoder;
import com.thoughtworks.xstream.security.AnyTypePermission;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -55,6 +57,7 @@ public class XStreamUnmarshallerTests {
public void createUnmarshaller() {
unmarshaller = new XStreamMarshaller();
unmarshaller.setTypePermissions(AnyTypePermission.ANY);
+ unmarshaller.setStreamDriver(new DomDriver("UTF-8", new XmlFriendlyNameCoder()));
Map> aliases = new HashMap<>();
aliases.put("flight", Flight.class);
unmarshaller.setAliases(aliases);
diff --git a/spring-test/spring-test.gradle b/spring-test/spring-test.gradle
index ea64eb6f2764..1cb742f451a9 100644
--- a/spring-test/spring-test.gradle
+++ b/spring-test/spring-test.gradle
@@ -79,6 +79,15 @@ dependencies {
testRuntimeOnly("com.sun.xml.bind:jaxb-impl")
}
+// Prevent xml-apis from being used so that the corresponding XML APIs from
+// the JDK's `java.xml` module are used instead. This allows spring-test to
+// build in Eclipse IDE which fails to compile if there is a split package
+// between a JDK system module and the unnamed module (for JARs on the
+// classpath).
+configurations.optional {
+ exclude group: "xml-apis", module: "xml-apis"
+}
+
test {
description = "Runs JUnit 4, JUnit Jupiter, and TestNG tests."
useJUnitPlatform {