package com.lanyuanxiaoyao.service.forest.configuration;

import cn.hutool.core.collection.ListUtil;
import com.dtflys.forest.converter.json.ForestJacksonConverter;
import com.dtflys.forest.springboot.annotation.ForestScan;
import com.dtflys.forest.springboot.properties.ForestConfigurationProperties;
import com.fasterxml.jackson.datatype.eclipsecollections.EclipseCollectionsModule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author lanyuanxiaoyao
 * @date 2023-04-24
 */
@ForestScan(basePackages = {
        "com.lanyuanxiaoyao.service.forest.service"
})
@Configuration
public class ForestsConfiguration {
    @Bean
    public ForestJacksonConverter forestJacksonConverter() {
        ForestJacksonConverter converter = new ForestJacksonConverter();
        converter.getMapper().registerModule(new EclipseCollectionsModule());
        return converter;
    }

    /*@Bean
    public ForestConfigurationProperties forestConfigurationProperties() {
        ForestConfigurationProperties properties = new ForestConfigurationProperties();
        properties.setBackend("httpclient");
        properties.setInterceptors(ListUtil.of(SpringCloudDiscoveryInterceptor.class));
        properties.setLogEnabled(false);
        properties.setTimeout(60000);
        return properties;
    }*/
}
