Saturday, 15 August 2015

java - jackson jboss eap6.1.1 annotations not working -


I have tried to get work in JBoss RestEasy application on an EAP 6.1.1 server Jackson annotations. To be more precise I would like to work through annotations like there.

Now it seems very easy, but for some reason it is not really working. I've received the following code:

  package example.model; Import com.fasterxml.jackson.annotation.JsonSubTypes; Import com.fasterxml.jackson.annotation.JsonTypeInfo; @JsonTypeInfo @JsonSubTypes (use = JsonTypeInfo.Id.CLASS, = JsonTypeInfo.As.PROPERTY, property = "@type", visible = true offers) ({@ JsonSubTypes.Type (value = ImplementedRequest.class, Name = "implementedrequest ")}) public abstract class request {}  

and implementation of abstract class:

  @JsonTypeInfo (use = JsonTypeInfo.Id.CLASS = JsonTypeInfo .s.PROPERTY, property = "@ type", visible = true) Public class implemented Requestextends request {@NotEmpty Private person applicant; Private listing & lt; AbstractApplicationPart & gt; Applications; }  

I made an endpoint that is a request to process a request:

  @Path ( "serviceRequest") @Named ( " RequestResource ") @ RequestScoped @Consumes (MediaType.APPLICATION_JSON) @Produces (MediaType.APPLICATION_JSON) @ValidateRequest @IgnoreMediaTypes (MediaType.APPLICATION_JSON) Public Class RequestResource {Public Valuation Requestable (@Walid Request Request, @ContaxSHttpserve Request), JAXBException, Encore {// some terrible processing happens here} public response getDummyData () {// applies and works Vit is. }}  

I have done some configuration now and have ensured that I load the Jackson's module in Jebus with war planning. And in my POM I am sure that I have the same version as the module

I hope I get something like that, then I make a call. "{": "Dummy data", "age": 31}, "application": [{"game": "football"}, {"game "" Judo "}]}

I field was expected to get a @ type name with the implemented implementation . This is my first attempt; After all, I also want to do abstract work in such a way but I can not even do that.

So in the end I thought what went wrong

import Com.fasterxml.jackson.annotation.JsonSubTypes; Import com.fasterxml.jackson.annotation.JsonTypeInfo;

What problems have 2 versions of Jackson and both work, but the default JBoss EAP6.1.1 1.X branch are under org.codehaus is. The problem is that both methods work under the core. It has since been transferred to a different branch and artwork.


No comments:

Post a Comment