Mannepalli H
Mannepalli H

Reputation: 77

jackson jaxb annotation for @XmlEnumValue

I have an @XmlEnumValue in a generated class and I want to test a JSON mesage (I will pass in JSON message the value that must be mapped to @XmlEnumValue) and see if my value is getting mapped. But I am unable to do this.I Solved a similar problem to read @XmlElement by adding below code. Id there any similar approach for supporting @XmlEnumValue also ??? I am looking for such annotaion property name..

 <bean id="jaxbAnnotationInspector"
    class="org.codehaus.jackson.xc.JaxbAnnotationIntrospector"/>
<bean id="jacksonObjectMapper" class="org.codehaus.jackson.map.ObjectMapper">
    <property name="annotationIntrospector" ref="jaxbAnnotationInspector"/>
</bean>

Upvotes: 4

Views: 2529

Answers (1)

StasKolodyuk
StasKolodyuk

Reputation: 4524

We're using such configuration to get it working

@Bean
public ObjectMapper objectMapper()
{
    ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.registerModule(new JaxbAnnotationModule());
    return objectMapper;
}

Upvotes: 6

Related Questions