检查我的JAXB实现 [英] Check my JAXB implementation
问题描述
我正在尝试使用Eclipselink的MOXy。我将jaxb.properties文件放在与带注释的类相同的目录中,它包含以下条目:
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
javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
无论如何我可以确定这个实现是在运行时使用的吗?
例如,我可以通过检查来检查我的StAX实现是Woodstox:
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()等于com.ctc.wstx。 stax.WstxInputFactory
inputFactory.getClass().getName() is equal com.ctc.wstx.stax.WstxInputFactory
我可以做些什么来检查我的JAXB实现吗?
Is there anything similar I can do to check my JAXB implementation?
谢谢。
推荐答案
来自此答案 :
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
}
}
这篇关于检查我的JAXB实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!