Jakarta EE 9 migration
Upgrades many dependency declarations; removes old EJB 2.x support and outdated Servlet-based integrations (Commons FileUpload, FreeMarker JSP support, Tiles). Closes gh-22093 Closes gh-25354 Closes gh-26185 Closes gh-27423 See gh-27424
This commit is contained in:
@@ -20,11 +20,11 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlRegistry;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import jakarta.xml.bind.annotation.XmlEnum;
|
||||
import jakarta.xml.bind.annotation.XmlRegistry;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
import jakarta.xml.bind.annotation.XmlSeeAlso;
|
||||
import jakarta.xml.bind.annotation.XmlType;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,22 +38,7 @@ import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.activation.DataHandler;
|
||||
import javax.activation.DataSource;
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBElement;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.MarshalException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import javax.xml.bind.UnmarshalException;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import javax.xml.bind.ValidationEventHandler;
|
||||
import javax.xml.bind.ValidationException;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||
import javax.xml.bind.attachment.AttachmentMarshaller;
|
||||
import javax.xml.bind.attachment.AttachmentUnmarshaller;
|
||||
import javax.xml.datatype.Duration;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
import javax.xml.namespace.QName;
|
||||
@@ -70,6 +55,21 @@ import javax.xml.transform.stream.StreamSource;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
|
||||
import jakarta.activation.DataHandler;
|
||||
import jakarta.activation.DataSource;
|
||||
import jakarta.xml.bind.JAXBContext;
|
||||
import jakarta.xml.bind.JAXBElement;
|
||||
import jakarta.xml.bind.JAXBException;
|
||||
import jakarta.xml.bind.MarshalException;
|
||||
import jakarta.xml.bind.Marshaller;
|
||||
import jakarta.xml.bind.UnmarshalException;
|
||||
import jakarta.xml.bind.Unmarshaller;
|
||||
import jakarta.xml.bind.ValidationEventHandler;
|
||||
import jakarta.xml.bind.ValidationException;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
import jakarta.xml.bind.annotation.adapters.XmlAdapter;
|
||||
import jakarta.xml.bind.attachment.AttachmentMarshaller;
|
||||
import jakarta.xml.bind.attachment.AttachmentUnmarshaller;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.w3c.dom.ls.LSResourceResolver;
|
||||
@@ -275,11 +275,11 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
||||
* <p>These properties will be set on the underlying JAXB {@code Marshaller},
|
||||
* and allow for features such as indentation.
|
||||
* @param properties the properties
|
||||
* @see javax.xml.bind.Marshaller#setProperty(String, Object)
|
||||
* @see javax.xml.bind.Marshaller#JAXB_ENCODING
|
||||
* @see javax.xml.bind.Marshaller#JAXB_FORMATTED_OUTPUT
|
||||
* @see javax.xml.bind.Marshaller#JAXB_NO_NAMESPACE_SCHEMA_LOCATION
|
||||
* @see javax.xml.bind.Marshaller#JAXB_SCHEMA_LOCATION
|
||||
* @see jakarta.xml.bind.Marshaller#setProperty(String, Object)
|
||||
* @see jakarta.xml.bind.Marshaller#JAXB_ENCODING
|
||||
* @see jakarta.xml.bind.Marshaller#JAXB_FORMATTED_OUTPUT
|
||||
* @see jakarta.xml.bind.Marshaller#JAXB_NO_NAMESPACE_SCHEMA_LOCATION
|
||||
* @see jakarta.xml.bind.Marshaller#JAXB_SCHEMA_LOCATION
|
||||
*/
|
||||
public void setMarshallerProperties(Map<String, ?> properties) {
|
||||
this.marshallerProperties = properties;
|
||||
@@ -289,7 +289,7 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
||||
* Set the JAXB {@code Unmarshaller} properties.
|
||||
* <p>These properties will be set on the underlying JAXB {@code Unmarshaller}.
|
||||
* @param properties the properties
|
||||
* @see javax.xml.bind.Unmarshaller#setProperty(String, Object)
|
||||
* @see jakarta.xml.bind.Unmarshaller#setProperty(String, Object)
|
||||
*/
|
||||
public void setUnmarshallerProperties(Map<String, ?> properties) {
|
||||
this.unmarshallerProperties = properties;
|
||||
@@ -409,7 +409,7 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
||||
|
||||
/**
|
||||
* Specify a JAXB mapped class for partial unmarshalling.
|
||||
* @see javax.xml.bind.Unmarshaller#unmarshal(javax.xml.transform.Source, Class)
|
||||
* @see jakarta.xml.bind.Unmarshaller#unmarshal(javax.xml.transform.Source, Class)
|
||||
*/
|
||||
public void setMappedClass(Class<?> mappedClass) {
|
||||
this.mappedClass = mappedClass;
|
||||
@@ -574,7 +574,7 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // on JDK 9
|
||||
@SuppressWarnings("deprecation")
|
||||
private Schema loadSchema(Resource[] resources, String schemaLanguage) throws IOException, SAXException {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Setting validation schema to " +
|
||||
@@ -857,7 +857,7 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // on JDK 9
|
||||
@SuppressWarnings("deprecation")
|
||||
private Source processSource(Source source) {
|
||||
if (StaxUtils.isStaxSource(source) || source instanceof DOMSource) {
|
||||
return source;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.oxm.mime;
|
||||
|
||||
import javax.activation.DataHandler;
|
||||
import jakarta.activation.DataHandler;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.oxm.jaxb;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class Airplane {
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
package org.springframework.oxm.jaxb;
|
||||
|
||||
import javax.activation.DataHandler;
|
||||
import javax.xml.bind.annotation.XmlAttachmentRef;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import jakarta.activation.DataHandler;
|
||||
import jakarta.xml.bind.annotation.XmlAttachmentRef;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(namespace = "http://springframework.org/spring-ws")
|
||||
public class BinaryObject {
|
||||
|
||||
@@ -23,11 +23,6 @@ import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.activation.DataHandler;
|
||||
import javax.activation.FileDataSource;
|
||||
import javax.xml.bind.JAXBElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.transform.Result;
|
||||
import javax.xml.transform.sax.SAXResult;
|
||||
@@ -35,6 +30,11 @@ import javax.xml.transform.sax.SAXSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import jakarta.activation.DataHandler;
|
||||
import jakarta.activation.FileDataSource;
|
||||
import jakarta.xml.bind.JAXBElement;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
import jakarta.xml.bind.annotation.XmlType;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.InOrder;
|
||||
@@ -141,7 +141,7 @@ class Jaxb2MarshallerTests extends AbstractMarshallerTests<Jaxb2Marshaller> {
|
||||
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
|
||||
marshaller.setContextPath(CONTEXT_PATH);
|
||||
marshaller.setMarshallerProperties(
|
||||
Collections.singletonMap(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE));
|
||||
Collections.singletonMap(jakarta.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE));
|
||||
marshaller.afterPropertiesSet();
|
||||
}
|
||||
|
||||
@@ -307,10 +307,10 @@ class Jaxb2MarshallerTests extends AbstractMarshallerTests<Jaxb2Marshaller> {
|
||||
|
||||
@Test // SPR-10806
|
||||
void unmarshalStreamSourceWithXmlOptions() throws Exception {
|
||||
final javax.xml.bind.Unmarshaller unmarshaller = mock(javax.xml.bind.Unmarshaller.class);
|
||||
final jakarta.xml.bind.Unmarshaller unmarshaller = mock(jakarta.xml.bind.Unmarshaller.class);
|
||||
Jaxb2Marshaller marshaller = new Jaxb2Marshaller() {
|
||||
@Override
|
||||
public javax.xml.bind.Unmarshaller createUnmarshaller() {
|
||||
public jakarta.xml.bind.Unmarshaller createUnmarshaller() {
|
||||
return unmarshaller;
|
||||
}
|
||||
};
|
||||
@@ -341,10 +341,10 @@ class Jaxb2MarshallerTests extends AbstractMarshallerTests<Jaxb2Marshaller> {
|
||||
|
||||
@Test // SPR-10806
|
||||
void unmarshalSaxSourceWithXmlOptions() throws Exception {
|
||||
final javax.xml.bind.Unmarshaller unmarshaller = mock(javax.xml.bind.Unmarshaller.class);
|
||||
final jakarta.xml.bind.Unmarshaller unmarshaller = mock(jakarta.xml.bind.Unmarshaller.class);
|
||||
Jaxb2Marshaller marshaller = new Jaxb2Marshaller() {
|
||||
@Override
|
||||
public javax.xml.bind.Unmarshaller createUnmarshaller() {
|
||||
public jakarta.xml.bind.Unmarshaller createUnmarshaller() {
|
||||
return unmarshaller;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,14 +20,14 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
|
||||
import javax.activation.DataHandler;
|
||||
import javax.activation.FileDataSource;
|
||||
import javax.xml.bind.JAXBElement;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import jakarta.activation.DataHandler;
|
||||
import jakarta.activation.FileDataSource;
|
||||
import jakarta.xml.bind.JAXBElement;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
|
||||
package org.springframework.oxm.jaxb;
|
||||
|
||||
import javax.xml.bind.JAXBElement;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import jakarta.xml.bind.JAXBElement;
|
||||
|
||||
/**
|
||||
* Used by {@link org.springframework.oxm.jaxb.Jaxb2MarshallerTests}.
|
||||
*
|
||||
|
||||
@@ -26,17 +26,18 @@ import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.activation.DataHandler;
|
||||
import javax.activation.DataSource;
|
||||
import javax.activation.URLDataSource;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.xml.bind.JAXBElement;
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
import javax.xml.datatype.DatatypeFactory;
|
||||
import javax.xml.datatype.Duration;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import jakarta.activation.DataHandler;
|
||||
import jakarta.activation.DataSource;
|
||||
import jakarta.activation.URLDataSource;
|
||||
import jakarta.xml.bind.JAXBElement;
|
||||
|
||||
/**
|
||||
* Used by {@link org.springframework.oxm.jaxb.Jaxb2MarshallerTests}.
|
||||
*
|
||||
@@ -58,7 +59,7 @@ public class StandardClasses {
|
||||
javax.xml.datatype.Duration
|
||||
java.lang.Object
|
||||
java.awt.Image
|
||||
javax.activation.DataHandler
|
||||
jakarta.activation.DataHandler
|
||||
javax.xml.transform.Source
|
||||
java.util.UUID
|
||||
*/
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
|
||||
package org.springframework.oxm.jaxb;
|
||||
|
||||
import javax.xml.bind.JAXBElement;
|
||||
import javax.xml.bind.annotation.XmlElementDecl;
|
||||
import javax.xml.bind.annotation.XmlRegistry;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import jakarta.xml.bind.JAXBElement;
|
||||
import jakarta.xml.bind.annotation.XmlElementDecl;
|
||||
import jakarta.xml.bind.annotation.XmlRegistry;
|
||||
|
||||
@XmlRegistry
|
||||
public class XmlRegObjectFactory {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user