sumit joshi
sumit joshi

Reputation: 47

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

Upvotes: 2

Views: 1150

Answers (1)

geffchang
geffchang

Reputation: 3340

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:

Upvotes: 2

Related Questions