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

com.infobip.jackson.JacksonAutoConfiguration Maven / Gradle / Ivy

The newest version!
package com.infobip.jackson;

import java.util.List;

import com.fasterxml.jackson.databind.module.SimpleModule;
import com.infobip.jackson.dynamic.DynamicHierarchyDeserializer;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class JacksonAutoConfiguration {

    @ConditionalOnMissingBean
    @Bean
    public InfobipJacksonModule infobipJacksonModule(List> dynamicHierarchyDeserializers) {
        InfobipJacksonModule module = new InfobipJacksonModule();
        dynamicHierarchyDeserializers.forEach(deserializer -> addDeserializer(module, deserializer));
        return module;
    }

    private  void addDeserializer(SimpleModule module, DynamicHierarchyDeserializer deserializer) {
        module.addDeserializer(deserializer.getHierarchyRootType(), deserializer);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy