问题
I am trying to use Eclipselink's MOXy. I put jaxb.properties file in the same directory as my annotated classes and it contains the entry:
javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
Is there anyway I can be sure this implementation is being used at runtime? For example, I can check my StAX implementation is Woodstox by checking:
inputFactory.getClass().getName() is equal com.ctc.wstx.stax.WstxInputFactory
Is there anything similar I can do to check my JAXB implementation?
Thanks.
回答1:
From this answer:
package example;
import javax.xml.bind.JAXBContext;
import example.foo.Foo;
public class Demo {
public static void main(String[] args) throws Exception{
System.out.println(JAXBContext.newInstance(Foo.class).getClass());
// If MOXy is used, this will print:
// class org.eclipse.persistence.jaxb.JAXBContext
}
}
来源:https://stackoverflow.com/questions/8626952/check-my-jaxb-implementation