package com.spring.common.converter;

import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;

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

public class CommHttpMessageConverter extends MappingJackson2HttpMessageConverter {
    
    public CommHttpMessageConverter(ObjectMapper objectMapper) {
        super(objectMapper);
        objectMapper.registerModule(new JavaTimeModule());
        setObjectMapper(objectMapper);
    }

    @Override
    public boolean canWrite(@NonNull Class<?> clazz, @Nullable MediaType mediaType) {
        return canWrite(mediaType);
    }

}
