Support scanned classes in Jaxb2Marshaller
Jaxb2Marshaller#supports now supports classes found via package scanning. Issue: SPR-9152
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user