简体   繁体   中英

How to use @JsonPropertyOrder annotation in beans.xml

I want to order my Data transfer object(POJO) created using beans.xml. can someone please tell me how to use @JsonPropertyOrder annotation in xml file rather than in Java?

Thanks much in advance

You can use the annotations element, like this:

<bean class="de.hybris.platform.couponfacades.data.AnnotatedPojo">

    <import type="javax.xml.bind.annotation.XmlRootElement"/>
    <import type="javax.xml.bind.annotation.XmlElements"/>
    <import type="javax.xml.bind.annotation.XmlElement"/>

    <annotations>@XmlRootElement</annotations>

    <property name="someText" type="String">

        <annotations scope="getter">
        @XmlElements(value = {
                @XmlElement(name="map",
                    type=ValueAsMap.class),
                @XmlElement(name="string",
                    type=ValueAsString.class)
        })
        </annotations>

    </property>

</bean>

Other reference:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM