diff --git a/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java b/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java index 9c6d621c4c..1886db9487 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java @@ -457,6 +457,7 @@ public class Jaxb2Marshaller if (logger.isDebugEnabled()) { logger.debug("Found JAXB2 classes: [" + StringUtils.arrayToCommaDelimitedString(jaxb2Classes) + "]"); } + this.classesToBeBound = jaxb2Classes; if (this.jaxbContextProperties != null) { return JAXBContext.newInstance(jaxb2Classes, this.jaxbContextProperties); } diff --git a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java index 63af36289f..a9a749dc0f 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java @@ -163,6 +163,14 @@ public class Jaxb2MarshallerTests extends AbstractMarshallerTests { marshaller.afterPropertiesSet(); testSupports(); } + + @Test + public void supportsPackagesToScan() throws Exception { + marshaller = new Jaxb2Marshaller(); + marshaller.setPackagesToScan(new String[] {CONTEXT_PATH}); + marshaller.afterPropertiesSet(); + testSupports(); + } private void testSupports() throws Exception { assertTrue("Jaxb2Marshaller does not support Flights class", marshaller.supports(Flights.class)); @@ -279,13 +287,6 @@ public class Jaxb2MarshallerTests extends AbstractMarshallerTests { assertTrue("No XML written", writer.toString().length() > 0); } - @Test - public void supportsPackagesToScan() throws Exception { - marshaller = new Jaxb2Marshaller(); - marshaller.setPackagesToScan(new String[] {CONTEXT_PATH}); - marshaller.afterPropertiesSet(); - } - @XmlRootElement public static class DummyRootElement {