I have looked around here and don't think this is a duplicate of any of these:
using Jackson annotations in Wildfly
jackson annotations being ignored
Wildfly and Jackson @JsonIgnore annotation
Using Wildfly 10 and deploying a war with the following class:
@Provider
public class JaxApplication implements ContextResolver<ObjectMapper> {
private final ObjectMapper mapper;
public JaxApplication() {
mapper = new ObjectMapper();
mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
//throw new RuntimeException("HERE");
}
@Override
public ObjectMapper getContext(Class<?> type) {
throw new RuntimeException("HERE");
//return mapper;
}
}
I see the exception in the constructor thrown when I deploy if it's not commented, but I don't see the one from the getContext
method when I make a request to my REST service.
I have a @JsonIgnore
annotation on an entity and it's not working, nor is the @JsonIdentityInfo
annotation I'm using
That class looks like this (imports included, to verify I'm using com.fasterxml.*)
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* Created by mb995a on 7/29/2016.
*/
@Entity
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@request_id", scope=Request.class)
public class Request extends BaseEntity {
Do I need to do something special in my REST config?
@ApplicationPath("api")
public class RestApplication extends Application {
public RestApplication() {
super();
}
}
Any ideas?
Edited to say: I also have a unit test that uses an ObjectMapper and it serializes properly.