Search in sources :

Example 16 with JaxbAnnotationModule

use of com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule in project Foundation by JoeyFan.

the class JsonMapper method enableJaxbAnnotation.

/**
 * 支持使用Jaxb的Annotation,使得POJO上的annotation不用与Jackson耦合。
 * 默认会先查找jaxb的annotation,如果找不到再找jackson的。
 */
public void enableJaxbAnnotation() {
    JaxbAnnotationModule module = new JaxbAnnotationModule();
    mapper.registerModule(module);
}
Also used : JaxbAnnotationModule(com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule)

Aggregations

JaxbAnnotationModule (com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule)16 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)11 StringWriter (java.io.StringWriter)3 JsonInclude (com.fasterxml.jackson.annotation.JsonInclude)2 DeserializationFeature (com.fasterxml.jackson.databind.DeserializationFeature)2 MapperFeature (com.fasterxml.jackson.databind.MapperFeature)2 Module (com.fasterxml.jackson.databind.Module)2 SerializationFeature (com.fasterxml.jackson.databind.SerializationFeature)2 Swagger (io.swagger.models.Swagger)2 OAuth2Definition (io.swagger.models.auth.OAuth2Definition)2 JsonGenerationException (com.fasterxml.jackson.core.JsonGenerationException)1 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)1 XmlMapper (com.fasterxml.jackson.dataformat.xml.XmlMapper)1 JavaTimeModule (com.fasterxml.jackson.datatype.jsr310.JavaTimeModule)1 AfterburnerModule (com.fasterxml.jackson.module.afterburner.AfterburnerModule)1 IOException (java.io.IOException)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1 HelloRequestType (org.openecard.ws.chipgateway.HelloRequestType)1 Test (org.testng.annotations.Test)1