Example usage for org.springframework.oxm.jaxb Jaxb2Marshaller setPackagesToScan

List of usage examples for org.springframework.oxm.jaxb Jaxb2Marshaller setPackagesToScan

Introduction

In this page you can find the example usage for org.springframework.oxm.jaxb Jaxb2Marshaller setPackagesToScan.

Prototype

public void setPackagesToScan(@Nullable String... packagesToScan) 

Source Link

Document

Set the packages to search for classes with JAXB2 annotations in the classpath.

Usage

From source file:org.cruk.genologics.api.jaxb.SerializationTest.java

@Test
@SuppressWarnings("unchecked")
public void testExceptionSimple() throws Throwable {
    // Cannot use configured because of aspects.
    Jaxb2Marshaller exceptionMarshaller = new Jaxb2Marshaller();
    exceptionMarshaller.setPackagesToScan(new String[] { "com.genologics.ri.exception" });
    exceptionMarshaller//from   w w w  . j a v  a2 s  .c  o  m
            .setMarshallerProperties(context.getBean("genologicsJaxbMarshallerProperties", Map.class));

    Jaxb2Marshaller original = marshaller;
    try {
        marshaller = exceptionMarshaller;
        fetchMarshalAndSerialize(com.genologics.ri.exception.Exception.class);
    } finally {
        marshaller = original;
    }
}