I was investigating object marshaling
and unMarshaling
using JAXB
. while noticed that there is two option of getting an instance of JAXBContext
.
- one is based on class:
JAXBContext context = JAXBContext.newInstance(ex.getClass());
- Other one is based on package name:
JAXBContext context = JAXBContext.newInstance(ex.getClass().getPackage().getName());
For the second way, you have to provide jaxb.index
file, containing list of bean class names.
Maybe someone can explain, what is the difference between this two methods of getting JAXBContext
instance? Which is better to use and when?