Frage

I was trying to set Moxy as my default JAXB provider cause i need another algorithm convention for XmlElement names, so i found very useful XMLNameTransformer.

I create package-info

@XmlNameTransformer(NameXMLPattern.class)
package com.onix.validadores.messages;

import com.onix.validadores.utils.NameXMLPattern;
import org.eclipse.persistence.oxm.annotations.XmlNameTransformer;

And jaxb.properties file

javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory

But when i make a main to test i get

System.out.println(JAXBContext.newInstance(RequestAutorizacion.class).getClass());

OUTPUT:

class com.sun.xml.bind.v2.runtime.JAXBContextImpl

But i wanted org.eclipse.persistence.jaxb.JAXBContext

I follow this tutorial

War es hilfreich?

Lösung

jaxb.properties location

The jaxb.properties file needs to go in the same package as one of the classes used to bootstrap the JAXBContext. For your use case it would need to go in the same package as the RequestAutorizacion class.

Name Transformer

Your implementation of name transformer can be in any package you like and does not impact where the jaxb.properties file should be located.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top