All Downloads are FREE. Search and download functionalities are using the official Maven repository.

JavaJaxRS.resteasy.JacksonConfig.mustache Maven / Gradle / Ivy

There is a newer version: 7.8.0
Show newest version
package {{invokerPackage}};

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;

import {{javaxPackage}}.ws.rs.ext.ContextResolver;
import {{javaxPackage}}.ws.rs.ext.Provider;
import java.io.IOException;

@Provider
public class JacksonConfig implements ContextResolver {
    private final ObjectMapper objectMapper;

    public JacksonConfig() throws Exception {

        objectMapper = new ObjectMapper()
            .registerModule(new JavaTimeModule())
            .setDateFormat(new RFC3339DateFormat());
    }

    public ObjectMapper getContext(Class arg0) {
        return objectMapper;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy